update tests

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

@ -52,14 +52,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -73,7 +72,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -134,6 +132,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -145,7 +160,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
var template = (function () {
@ -187,7 +204,7 @@ function create_main_fragment ( state, component ) {
},
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;
}
},
@ -226,12 +243,4 @@ function SvelteComponent ( options ) {
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;

@ -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 () {
return {
@ -39,7 +39,7 @@ function create_main_fragment ( state, component ) {
},
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;
}
},
@ -78,12 +78,4 @@ function SvelteComponent ( options ) {
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;

@ -28,14 +28,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -49,7 +48,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -110,6 +108,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -121,16 +136,11 @@ var proto = {
observe: observe,
on: on,
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 () {
return {
computed: {
@ -147,6 +157,8 @@ function create_main_fragment ( state, component ) {
mount: noop,
update: noop,
unmount: noop,
destroy: noop
@ -156,7 +168,7 @@ function create_main_fragment ( state, component ) {
function SvelteComponent ( options ) {
options = options || {};
this._state = options.data || {};
recompute( this._state, this._state, {}, true );
this._recompute( {}, this._state, {}, true );
this._observers = {
pre: Object.create( null ),
@ -178,12 +190,11 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
recompute( this._state, newState, oldState, false );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
SvelteComponent.prototype._recompute = function _recompute ( changed, state, oldState, isInitial ) {
if ( isInitial || ( 'x' in changed ) ) {
if ( differs( ( state.a = template.computed.a( state.x ) ), oldState.a ) ) changed.a = true;
if ( differs( ( state.b = template.computed.b( state.x ) ), oldState.b ) ) changed.b = true;
}
};
export default SvelteComponent;

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

@ -48,14 +48,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -69,7 +68,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -130,6 +128,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -141,7 +156,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
function encapsulateStyles ( node ) {
@ -172,6 +189,8 @@ function create_main_fragment ( state, component ) {
insertNode( div, target, anchor );
},
update: noop,
unmount: function () {
detachNode( div );
},
@ -206,11 +225,4 @@ function SvelteComponent ( options ) {
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;

@ -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 ) {
setAttribute( node, 'svelte-2363328337', '' );
@ -28,6 +28,8 @@ function create_main_fragment ( state, component ) {
insertNode( div, target, anchor );
},
update: noop,
unmount: function () {
detachNode( div );
},
@ -62,11 +64,4 @@ function SvelteComponent ( options ) {
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;

@ -61,14 +61,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -82,7 +81,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -143,6 +141,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -154,7 +169,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
function create_main_fragment ( state, component ) {
@ -210,7 +227,7 @@ function create_main_fragment ( state, component ) {
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;
}
},
@ -272,15 +289,11 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
},
update: function ( changed, state, each_block_value, comment, i ) {
if ( text_value !== ( text_value = i ) ) {
text.data = text_value;
}
if ( text_2_value !== ( text_2_value = comment.author ) ) {
if ( ( 'comments' in changed ) && text_2_value !== ( text_2_value = comment.author ) ) {
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;
}
@ -324,12 +337,4 @@ function SvelteComponent ( options ) {
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;

@ -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 ) {
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;
}
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;
}
},
@ -115,15 +115,11 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
},
update: function ( changed, state, each_block_value, comment, i ) {
if ( text_value !== ( text_value = i ) ) {
text.data = text_value;
}
if ( text_2_value !== ( text_2_value = comment.author ) ) {
if ( ( 'comments' in changed ) && text_2_value !== ( text_2_value = comment.author ) ) {
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;
}
@ -167,12 +163,4 @@ function SvelteComponent ( options ) {
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;

@ -48,14 +48,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -69,7 +68,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -130,6 +128,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -141,7 +156,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
var template = (function () {
@ -181,6 +198,8 @@ function create_main_fragment ( state, component ) {
appendNode( text, button );
},
update: noop,
unmount: function () {
detachNode( button );
},
@ -215,11 +234,4 @@ function SvelteComponent ( options ) {
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;

@ -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 () {
return {
@ -37,6 +37,8 @@ function create_main_fragment ( state, component ) {
appendNode( text, button );
},
update: noop,
unmount: function () {
detachNode( button );
},
@ -71,11 +73,4 @@ function SvelteComponent ( options ) {
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;

@ -52,14 +52,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -73,7 +72,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -134,6 +132,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -145,7 +160,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
function create_main_fragment ( state, component ) {
@ -259,12 +276,4 @@ function SvelteComponent ( options ) {
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;

@ -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 ) {
var if_block_anchor;
@ -111,12 +111,4 @@ function SvelteComponent ( options ) {
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;

@ -52,14 +52,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -73,7 +72,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -134,6 +132,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -145,7 +160,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
function create_main_fragment ( state, component ) {
@ -235,12 +252,4 @@ function SvelteComponent ( options ) {
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;

@ -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 ) {
var if_block_anchor;
@ -87,12 +87,4 @@ function SvelteComponent ( options ) {
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;

@ -42,14 +42,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -63,7 +62,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -124,6 +122,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -135,7 +150,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
var template = (function () {
@ -170,6 +187,8 @@ function create_main_fragment ( state, component ) {
nonimported._fragment.mount( target, anchor );
},
update: noop,
unmount: function () {
imported._fragment.unmount();
detachNode( text );
@ -221,11 +240,4 @@ function SvelteComponent ( options ) {
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;

@ -1,6 +1,6 @@
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 () {
return {
@ -34,6 +34,8 @@ function create_main_fragment ( state, component ) {
nonimported._fragment.mount( target, anchor );
},
update: noop,
unmount: function () {
imported._fragment.unmount();
detachNode( text );
@ -85,11 +87,4 @@ function SvelteComponent ( options ) {
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;

@ -28,14 +28,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -49,7 +48,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -110,6 +108,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -121,7 +136,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
var template = (function () {
@ -139,6 +156,8 @@ function create_main_fragment ( state, component ) {
mount: noop,
update: noop,
unmount: noop,
destroy: noop
@ -182,11 +201,4 @@ function SvelteComponent ( options ) {
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;

@ -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 () {
return {
@ -15,6 +15,8 @@ function create_main_fragment ( state, component ) {
mount: noop,
update: noop,
unmount: noop,
destroy: noop
@ -58,11 +60,4 @@ function SvelteComponent ( options ) {
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;

@ -28,14 +28,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -49,7 +48,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -110,6 +108,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -121,7 +136,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
var template = (function () {
@ -150,6 +167,8 @@ function create_main_fragment ( state, component ) {
mount: noop,
update: noop,
unmount: noop,
destroy: noop
@ -180,13 +199,6 @@ function SvelteComponent ( options ) {
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 );
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 () {
return {
@ -26,6 +26,8 @@ function create_main_fragment ( state, component ) {
mount: noop,
update: noop,
unmount: noop,
destroy: noop
@ -56,13 +58,6 @@ function SvelteComponent ( options ) {
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 );
export default SvelteComponent;

@ -52,14 +52,13 @@ function differs(a, b) {
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) {
if (!(key in newState)) continue;
if (!(key in changed)) continue;
var newValue = newState[key];
var oldValue = oldState[key];
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
@ -73,7 +72,6 @@ function dispatchObservers(component, group, newState, oldState) {
}
}
}
}
function get(key) {
return key ? this._state[key] : this._state;
@ -134,6 +132,23 @@ function set(newState) {
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) {
while (fns && fns.length) fns.pop()();
}
@ -145,7 +160,9 @@ var proto = {
observe: observe,
on: on,
set: set,
teardown: destroy
teardown: destroy,
_recompute: noop,
_set: _set
};
function create_main_fragment ( state, component ) {
@ -419,12 +436,4 @@ function SvelteComponent ( options ) {
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;

@ -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 ) {
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 );
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;
Loading…
Cancel
Save