|
|
|
@ -46,6 +46,10 @@ function createText(data) {
|
|
|
|
|
return document.createTextNode(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function blankObject() {
|
|
|
|
|
return Object.create(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function destroy(detach) {
|
|
|
|
|
this.destroy = noop;
|
|
|
|
|
this.fire('destroy');
|
|
|
|
@ -81,10 +85,6 @@ function dispatchObservers(component, group, changed, newState, oldState) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get(key) {
|
|
|
|
|
return key ? this._state[key] : this._state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fire(eventName, data) {
|
|
|
|
|
var handlers =
|
|
|
|
|
eventName in this._handlers && this._handlers[eventName].slice();
|
|
|
|
@ -95,6 +95,20 @@ function fire(eventName, data) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get(key) {
|
|
|
|
|
return key ? this._state[key] : this._state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function init(component, options) {
|
|
|
|
|
component.options = options;
|
|
|
|
|
|
|
|
|
|
component._observers = { pre: blankObject(), post: blankObject() };
|
|
|
|
|
component._handlers = blankObject();
|
|
|
|
|
component._root = options._root || component;
|
|
|
|
|
component._yield = options._yield;
|
|
|
|
|
component._bind = options._bind;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function observe(key, callback, options) {
|
|
|
|
|
var group = options && options.defer
|
|
|
|
|
? this._observers.post
|
|
|
|
@ -184,6 +198,8 @@ var proto = {
|
|
|
|
|
_unmount: _unmount
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* generated by Svelte v1.39.3 */
|
|
|
|
|
|
|
|
|
|
function create_main_fragment(state, component) {
|
|
|
|
|
var text, p, text_1;
|
|
|
|
|
|
|
|
|
@ -237,7 +253,7 @@ function create_main_fragment(state, component) {
|
|
|
|
|
each_block_iterations.length = each_block_value.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( changed.foo ) {
|
|
|
|
|
if (changed.foo) {
|
|
|
|
|
text_1.data = state.foo;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -257,6 +273,7 @@ function create_main_fragment(state, component) {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (1:0) {{#each comments as comment, i}}
|
|
|
|
|
function create_each_block(state, each_block_value, comment, i, component) {
|
|
|
|
|
var div, strong, text, text_1, span, text_2_value = comment.author, text_2, text_3, text_4_value = state.elapsed(comment.time, state.time), text_4, text_5, text_6, raw_value = comment.html, raw_before;
|
|
|
|
|
|
|
|
|
@ -297,15 +314,15 @@ function create_each_block(state, each_block_value, comment, i, component) {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
update: function(changed, state, each_block_value, comment, i) {
|
|
|
|
|
if ( (changed.comments) && text_2_value !== (text_2_value = comment.author) ) {
|
|
|
|
|
if ((changed.comments) && text_2_value !== (text_2_value = comment.author)) {
|
|
|
|
|
text_2.data = text_2_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (changed.elapsed || changed.comments || changed.time) && text_4_value !== (text_4_value = state.elapsed(comment.time, state.time)) ) {
|
|
|
|
|
if ((changed.elapsed || changed.comments || changed.time) && text_4_value !== (text_4_value = state.elapsed(comment.time, state.time))) {
|
|
|
|
|
text_4.data = text_4_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (changed.comments) && raw_value !== (raw_value = comment.html) ) {
|
|
|
|
|
if ((changed.comments) && raw_value !== (raw_value = comment.html)) {
|
|
|
|
|
detachAfter(raw_before);
|
|
|
|
|
raw_before.insertAdjacentHTML("afterend", raw_value);
|
|
|
|
|
}
|
|
|
|
@ -322,20 +339,9 @@ function create_each_block(state, each_block_value, comment, i, component) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SvelteComponent(options) {
|
|
|
|
|
this.options = options;
|
|
|
|
|
init(this, options);
|
|
|
|
|
this._state = options.data || {};
|
|
|
|
|
|
|
|
|
|
this._observers = {
|
|
|
|
|
pre: Object.create(null),
|
|
|
|
|
post: Object.create(null)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this._handlers = Object.create(null);
|
|
|
|
|
|
|
|
|
|
this._root = options._root || this;
|
|
|
|
|
this._yield = options._yield;
|
|
|
|
|
this._bind = options._bind;
|
|
|
|
|
|
|
|
|
|
this._fragment = create_main_fragment(this._state, this);
|
|
|
|
|
|
|
|
|
|
if (options.target) {
|
|
|
|
|