mirror of https://github.com/sveltejs/svelte
parent
ad653c5834
commit
7407bccb79
@ -1,48 +1,51 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, safe_not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
var Nested = window.Nested;
|
const Nested = window.Nested;
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
|
var current;
|
||||||
|
|
||||||
var nested_initial_data = { foo: [1, 2, 3] };
|
|
||||||
var nested = new Nested({
|
var nested = new Nested({
|
||||||
root: component.root,
|
props: { foo: [1, 2, 3] }
|
||||||
store: component.store,
|
|
||||||
data: nested_initial_data
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
nested._fragment.c();
|
nested.$$.fragment.c();
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
nested._mount(target, anchor);
|
mount_component(nested, target, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o(outrocallback) {
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
if (nested) nested.$$.fragment.o(outrocallback);
|
||||||
|
current = false;
|
||||||
|
},
|
||||||
|
|
||||||
d(detach) {
|
d(detach) {
|
||||||
nested.destroy(detach);
|
nested.$destroy(detach);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
init(this, options);
|
constructor(options) {
|
||||||
this._state = assign({}, options.data);
|
super();
|
||||||
this._intro = true;
|
init(this, options, noop, create_fragment, safe_not_equal);
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
|
||||||
|
|
||||||
if (options.target) {
|
|
||||||
this._fragment.c();
|
|
||||||
this._mount(options.target, options.anchor);
|
|
||||||
|
|
||||||
flush(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,50 +1,51 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { _differsImmutable, assign, flush, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
var Nested = window.Nested;
|
const Nested = window.Nested;
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
|
var current;
|
||||||
|
|
||||||
var nested_initial_data = { foo: "bar" };
|
|
||||||
var nested = new Nested({
|
var nested = new Nested({
|
||||||
root: component.root,
|
props: { foo: "bar" }
|
||||||
store: component.store,
|
|
||||||
data: nested_initial_data
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
nested._fragment.c();
|
nested.$$.fragment.c();
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
nested._mount(target, anchor);
|
mount_component(nested, target, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
|
||||||
d(detach) {
|
i(target, anchor) {
|
||||||
nested.destroy(detach);
|
if (current) return;
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
this.m(target, anchor);
|
||||||
init(this, options);
|
},
|
||||||
this._state = assign({}, options.data);
|
|
||||||
this._intro = true;
|
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
o(outrocallback) {
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
if (options.target) {
|
if (nested) nested.$$.fragment.o(outrocallback);
|
||||||
this._fragment.c();
|
current = false;
|
||||||
this._mount(options.target, options.anchor);
|
},
|
||||||
|
|
||||||
flush(this);
|
d(detach) {
|
||||||
|
nested.$destroy(detach);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, noop, create_fragment, not_equal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SvelteComponent.prototype._differs = _differsImmutable;
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,48 +1,51 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, safe_not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
var Nested = window.Nested;
|
const Nested = window.Nested;
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
|
var current;
|
||||||
|
|
||||||
var nested_initial_data = { foo: "bar" };
|
|
||||||
var nested = new Nested({
|
var nested = new Nested({
|
||||||
root: component.root,
|
props: { foo: "bar" }
|
||||||
store: component.store,
|
|
||||||
data: nested_initial_data
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
nested._fragment.c();
|
nested.$$.fragment.c();
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
nested._mount(target, anchor);
|
mount_component(nested, target, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o(outrocallback) {
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
if (nested) nested.$$.fragment.o(outrocallback);
|
||||||
|
current = false;
|
||||||
|
},
|
||||||
|
|
||||||
d(detach) {
|
d(detach) {
|
||||||
nested.destroy(detach);
|
nested.$destroy(detach);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
init(this, options);
|
constructor(options) {
|
||||||
this._state = assign({}, options.data);
|
super();
|
||||||
this._intro = true;
|
init(this, options, noop, create_fragment, safe_not_equal);
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
|
||||||
|
|
||||||
if (options.target) {
|
|
||||||
this._fragment.c();
|
|
||||||
this._mount(options.target, options.anchor);
|
|
||||||
|
|
||||||
flush(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,48 +1,46 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, assignTrue, flush, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, flush, init, noop, run, safe_not_equal } from "svelte/internal.js";
|
||||||
|
import { onMount } from "svelte";
|
||||||
function data_1() {
|
|
||||||
return {
|
|
||||||
foo: 'bar'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function oncreate() {
|
|
||||||
alert(JSON.stringify(data()));
|
|
||||||
};
|
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
|
||||||
|
|
||||||
|
function create_fragment(component, ctx) {
|
||||||
return {
|
return {
|
||||||
c: noop,
|
c: noop,
|
||||||
|
|
||||||
m: noop,
|
m: noop,
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
i: noop,
|
||||||
|
o: run,
|
||||||
d: noop
|
d: noop
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
function define($$self, $$props) {
|
||||||
init(this, options);
|
let { foo = 'bar' } = $$props;
|
||||||
this._state = assign(data_1(), options.data);
|
|
||||||
this._intro = true;
|
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
|
||||||
|
|
||||||
this.root._oncreate.push(() => {
|
onMount(() => {
|
||||||
oncreate.call(this);
|
alert(JSON.stringify(data()));
|
||||||
this.fire("update", { changed: assignTrue({}, this._state), current: this._state });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.target) {
|
$$self.$$.get = () => ({ foo });
|
||||||
this._fragment.c();
|
|
||||||
this._mount(options.target, options.anchor);
|
$$self.$$.set = $$props => {
|
||||||
|
if ('foo' in $$props) foo = $$props.foo;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, define, create_fragment, safe_not_equal);
|
||||||
|
}
|
||||||
|
|
||||||
|
get foo() {
|
||||||
|
return this.$$.get().foo;
|
||||||
|
}
|
||||||
|
|
||||||
flush(this);
|
set foo(value) {
|
||||||
|
this.$set({ foo: value });
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,46 +1,72 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, flush, init, mount_component, safe_not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function func() {
|
||||||
|
return import('./Foo.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_fragment(component, ctx) {
|
||||||
|
var current;
|
||||||
|
|
||||||
var lazyload_initial_data = { load: () => import('./Foo.html') };
|
var lazyload = new ctx.LazyLoad({
|
||||||
var lazyload = new LazyLoad({
|
props: { load: func }
|
||||||
root: component.root,
|
|
||||||
store: component.store,
|
|
||||||
data: lazyload_initial_data
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
lazyload._fragment.c();
|
lazyload.$$.fragment.c();
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
lazyload._mount(target, anchor);
|
mount_component(lazyload, target, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o(outrocallback) {
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
if (lazyload) lazyload.$$.fragment.o(outrocallback);
|
||||||
|
current = false;
|
||||||
|
},
|
||||||
|
|
||||||
d(detach) {
|
d(detach) {
|
||||||
lazyload.destroy(detach);
|
lazyload.$destroy(detach);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
function define($$self, $$props) {
|
||||||
init(this, options);
|
let { LazyLoad } = $$props;
|
||||||
this._state = assign({}, options.data);
|
|
||||||
this._intro = true;
|
$$self.$$.get = () => ({ LazyLoad });
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
$$self.$$.set = $$props => {
|
||||||
|
if ('LazyLoad' in $$props) LazyLoad = $$props.LazyLoad;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (options.target) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
this._fragment.c();
|
constructor(options) {
|
||||||
this._mount(options.target, options.anchor);
|
super();
|
||||||
|
init(this, options, define, create_fragment, safe_not_equal);
|
||||||
|
}
|
||||||
|
|
||||||
|
get LazyLoad() {
|
||||||
|
return this.$$.get().LazyLoad;
|
||||||
|
}
|
||||||
|
|
||||||
flush(this);
|
set LazyLoad(value) {
|
||||||
|
this.$set({ LazyLoad: value });
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,60 +1,77 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, flush, init, insert, noop, removeListener, run, safe_not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
function foo( node, callback ) {
|
function handleFoo(bar) {
|
||||||
// code goes here
|
|
||||||
};
|
|
||||||
|
|
||||||
var methods = {
|
|
||||||
foo ( bar ) {
|
|
||||||
console.log(bar);
|
console.log(bar);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
var button, foo_handler;
|
var button, current;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
button = createElement("button");
|
button = createElement("button");
|
||||||
button.textContent = "foo";
|
button.textContent = "foo";
|
||||||
foo_handler = foo.call(component, button, function(event) {
|
addListener(button, "foo", ctx.foo_handler);
|
||||||
component.foo( ctx.bar );
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
insert(target, button, anchor);
|
insert(target, button, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p(changed, _ctx) {
|
p: noop,
|
||||||
ctx = _ctx;
|
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
o: run,
|
||||||
|
|
||||||
d(detach) {
|
d(detach) {
|
||||||
if (detach) {
|
if (detach) {
|
||||||
detachNode(button);
|
detachNode(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
foo_handler.destroy();
|
removeListener(button, "foo", ctx.foo_handler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
function define($$self, $$props) {
|
||||||
init(this, options);
|
let { bar } = $$props;
|
||||||
this._state = assign({}, options.data);
|
|
||||||
this._intro = true;
|
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
function foo(node, callback) {
|
||||||
|
// code goes here
|
||||||
|
}
|
||||||
|
|
||||||
if (options.target) {
|
function foo_handler() {
|
||||||
this._fragment.c();
|
return handleFoo(bar);
|
||||||
this._mount(options.target, options.anchor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO only what's needed by the template
|
||||||
|
$$self.$$.get = () => ({ bar, foo_handler });
|
||||||
|
|
||||||
|
$$self.$$.set = $$props => {
|
||||||
|
if ('bar' in $$props) bar = $$props.bar;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, define, create_fragment, safe_not_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
get bar() {
|
||||||
assign(SvelteComponent.prototype, methods);
|
return this.$$.get().bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
set bar(value) {
|
||||||
|
this.$set({ bar: value });
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,99 +1,198 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { addListener, assign, createElement, detachNode, flush, init, insert, proto, removeListener, timeRangesToArray } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, addListener, add_render_callback, createElement, detachNode, flush, init, insert, removeListener, run, safe_not_equal, timeRangesToArray } from "svelte/internal.js";
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
var audio, audio_is_paused = true, audio_updating = false, audio_animationframe;
|
var audio, audio_is_paused = true, audio_updating = false, audio_animationframe, current;
|
||||||
|
|
||||||
|
return {
|
||||||
|
c() {
|
||||||
|
audio = createElement("audio");
|
||||||
|
addListener(audio, "timeupdate", ctx.audio_timeupdate_handler);
|
||||||
|
if (ctx.played === void 0 || ctx.currentTime === void 0) add_render_callback(() => ctx.audio_timeupdate_handler.call(audio));
|
||||||
|
addListener(audio, "durationchange", ctx.audio_durationchange_handler);
|
||||||
|
if (ctx.duration === void 0) add_render_callback(() => ctx.audio_durationchange_handler.call(audio));
|
||||||
|
addListener(audio, "play", ctx.audio_play_pause_handler);
|
||||||
|
addListener(audio, "pause", ctx.audio_play_pause_handler);
|
||||||
|
addListener(audio, "progress", ctx.audio_progress_handler);
|
||||||
|
if (ctx.buffered === void 0) add_render_callback(() => ctx.audio_progress_handler.call(audio));
|
||||||
|
addListener(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler);
|
||||||
|
if (ctx.buffered === void 0 || ctx.seekable === void 0) add_render_callback(() => ctx.audio_loadedmetadata_handler.call(audio));
|
||||||
|
addListener(audio, "volumechange", ctx.audio_volumechange_handler);
|
||||||
|
},
|
||||||
|
|
||||||
|
m(target, anchor) {
|
||||||
|
insert(target, audio, anchor);
|
||||||
|
|
||||||
|
audio.volume = ctx.volume;
|
||||||
|
|
||||||
|
current = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
p(changed, ctx) {
|
||||||
|
if (!audio_updating && !isNaN(ctx.currentTime ) && changed.currentTime) audio.currentTime = ctx.currentTime ;
|
||||||
|
if (!audio_updating && audio_is_paused !== (audio_is_paused = ctx.paused ) && changed.paused) audio[audio_is_paused ? "pause" : "play"]();
|
||||||
|
if (!audio_updating && !isNaN(ctx.volume) && changed.volume) audio.volume = ctx.volume;
|
||||||
|
},
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o: run,
|
||||||
|
|
||||||
|
d(detach) {
|
||||||
|
if (detach) {
|
||||||
|
detachNode(audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeListener(audio, "timeupdate", ctx.audio_timeupdate_handler);
|
||||||
|
removeListener(audio, "durationchange", ctx.audio_durationchange_handler);
|
||||||
|
removeListener(audio, "play", ctx.audio_play_pause_handler);
|
||||||
|
removeListener(audio, "pause", ctx.audio_play_pause_handler);
|
||||||
|
removeListener(audio, "progress", ctx.audio_progress_handler);
|
||||||
|
removeListener(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler);
|
||||||
|
removeListener(audio, "volumechange", ctx.audio_volumechange_handler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function define($$self, $$make_dirty) {
|
||||||
|
// TODO some of these are read-only...
|
||||||
|
let { buffered, seekable, played, currentTime, duration, paused, volume } = $$props;
|
||||||
|
|
||||||
function audio_timeupdate_handler() {
|
function audio_timeupdate_handler() {
|
||||||
cancelAnimationFrame(audio_animationframe);
|
cancelAnimationFrame(audio_animationframe);
|
||||||
if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
|
if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
|
||||||
audio_updating = true;
|
played = timeRangesToArray(this.played);
|
||||||
component.set({ played: timeRangesToArray(audio.played), currentTime: audio.currentTime });
|
currentTime = this.currentTime;
|
||||||
audio_updating = false;
|
$$make_dirty('played');
|
||||||
|
$$make_dirty('currentTime');
|
||||||
}
|
}
|
||||||
|
|
||||||
function audio_durationchange_handler() {
|
function audio_durationchange_handler() {
|
||||||
component.set({ duration: audio.duration });
|
duration = this.duration;
|
||||||
|
$$make_dirty('duration');
|
||||||
}
|
}
|
||||||
|
|
||||||
function audio_play_pause_handler() {
|
function audio_play_pause_handler() {
|
||||||
audio_updating = true;
|
paused = this.paused;
|
||||||
component.set({ paused: audio.paused });
|
$$make_dirty('paused');
|
||||||
audio_updating = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function audio_progress_handler() {
|
function audio_progress_handler() {
|
||||||
component.set({ buffered: timeRangesToArray(audio.buffered) });
|
buffered = timeRangesToArray(this.buffered);
|
||||||
|
$$make_dirty('buffered');
|
||||||
}
|
}
|
||||||
|
|
||||||
function audio_loadedmetadata_handler() {
|
function audio_loadedmetadata_handler() {
|
||||||
component.set({ buffered: timeRangesToArray(audio.buffered), seekable: timeRangesToArray(audio.seekable) });
|
buffered = timeRangesToArray(this.buffered);
|
||||||
|
seekable = timeRangesToArray(this.seekable);
|
||||||
|
$$make_dirty('buffered');
|
||||||
|
$$make_dirty('seekable');
|
||||||
}
|
}
|
||||||
|
|
||||||
function audio_volumechange_handler() {
|
function audio_volumechange_handler() {
|
||||||
audio_updating = true;
|
volume = this.volume;
|
||||||
component.set({ volume: audio.volume });
|
$$make_dirty('volume');
|
||||||
audio_updating = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
$$self.$$.get = () => ({
|
||||||
c() {
|
buffered,
|
||||||
audio = createElement("audio");
|
seekable,
|
||||||
addListener(audio, "timeupdate", audio_timeupdate_handler);
|
played,
|
||||||
if (!('played' in ctx && 'currentTime' in ctx)) component.root._beforecreate.push(audio_timeupdate_handler);
|
currentTime,
|
||||||
addListener(audio, "durationchange", audio_durationchange_handler);
|
duration,
|
||||||
if (!('duration' in ctx)) component.root._beforecreate.push(audio_durationchange_handler);
|
paused,
|
||||||
addListener(audio, "play", audio_play_pause_handler);
|
volume,
|
||||||
addListener(audio, "pause", audio_play_pause_handler);
|
audio_timeupdate_handler,
|
||||||
addListener(audio, "progress", audio_progress_handler);
|
audio_durationchange_handler,
|
||||||
if (!('buffered' in ctx)) component.root._beforecreate.push(audio_progress_handler);
|
audio_play_pause_handler,
|
||||||
addListener(audio, "loadedmetadata", audio_loadedmetadata_handler);
|
audio_progress_handler,
|
||||||
if (!('buffered' in ctx && 'seekable' in ctx)) component.root._beforecreate.push(audio_loadedmetadata_handler);
|
audio_loadedmetadata_handler,
|
||||||
addListener(audio, "volumechange", audio_volumechange_handler);
|
audio_volumechange_handler
|
||||||
},
|
});
|
||||||
|
|
||||||
|
$$self.$$.set = $$props => {
|
||||||
|
if ('buffered' in $$props) buffered = $$props.buffered;
|
||||||
|
if ('seekable' in $$props) seekable = $$props.seekable;
|
||||||
|
if ('played' in $$props) played = $$props.played;
|
||||||
|
if ('currentTime' in $$props) currentTime = $$props.currentTime;
|
||||||
|
if ('duration' in $$props) duration = $$props.duration;
|
||||||
|
if ('paused' in $$props) paused = $$props.paused;
|
||||||
|
if ('volume' in $$props) volume = $$props.volume;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
m(target, anchor) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
insert(target, audio, anchor);
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, define, create_fragment, safe_not_equal);
|
||||||
|
}
|
||||||
|
|
||||||
audio.volume = ctx.volume;
|
get buffered() {
|
||||||
},
|
return this.$$.get().buffered;
|
||||||
|
}
|
||||||
|
|
||||||
p(changed, ctx) {
|
set buffered(value) {
|
||||||
if (!audio_updating && !isNaN(ctx.currentTime ) && changed.currentTime) audio.currentTime = ctx.currentTime ;
|
this.$set({ buffered: value });
|
||||||
if (!audio_updating && audio_is_paused !== (audio_is_paused = ctx.paused ) && changed.paused) audio[audio_is_paused ? "pause" : "play"]();
|
flush();
|
||||||
if (!audio_updating && !isNaN(ctx.volume) && changed.volume) audio.volume = ctx.volume;
|
}
|
||||||
},
|
|
||||||
|
|
||||||
d(detach) {
|
get seekable() {
|
||||||
if (detach) {
|
return this.$$.get().seekable;
|
||||||
detachNode(audio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeListener(audio, "timeupdate", audio_timeupdate_handler);
|
set seekable(value) {
|
||||||
removeListener(audio, "durationchange", audio_durationchange_handler);
|
this.$set({ seekable: value });
|
||||||
removeListener(audio, "play", audio_play_pause_handler);
|
flush();
|
||||||
removeListener(audio, "pause", audio_play_pause_handler);
|
|
||||||
removeListener(audio, "progress", audio_progress_handler);
|
|
||||||
removeListener(audio, "loadedmetadata", audio_loadedmetadata_handler);
|
|
||||||
removeListener(audio, "volumechange", audio_volumechange_handler);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
get played() {
|
||||||
|
return this.$$.get().played;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
set played(value) {
|
||||||
init(this, options);
|
this.$set({ played: value });
|
||||||
this._state = assign({}, options.data);
|
flush();
|
||||||
this._intro = true;
|
}
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
get currentTime() {
|
||||||
|
return this.$$.get().currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
set currentTime(value) {
|
||||||
|
this.$set({ currentTime: value });
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
if (options.target) {
|
get duration() {
|
||||||
this._fragment.c();
|
return this.$$.get().duration;
|
||||||
this._mount(options.target, options.anchor);
|
}
|
||||||
|
|
||||||
|
set duration(value) {
|
||||||
|
this.$set({ duration: value });
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
get paused() {
|
||||||
|
return this.$$.get().paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
set paused(value) {
|
||||||
|
this.$set({ paused: value });
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
get volume() {
|
||||||
|
return this.$$.get().volume;
|
||||||
|
}
|
||||||
|
|
||||||
flush(this);
|
set volume(value) {
|
||||||
|
this.$set({ volume: value });
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,62 +1,63 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, createText, detachNode, flush, init, insert, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, callAfter, createText, detachNode, init, insert, mount_component, noop, safe_not_equal } from "svelte/internal.js";
|
||||||
import Imported from 'Imported.html';
|
import Imported from "Imported.html";
|
||||||
|
|
||||||
|
function create_fragment(component, ctx) {
|
||||||
|
var text, current;
|
||||||
|
|
||||||
|
var imported = new Imported({});
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
var nonimported = new NonImported({});
|
||||||
var text;
|
|
||||||
|
|
||||||
var imported = new Imported({
|
|
||||||
root: component.root,
|
|
||||||
store: component.store
|
|
||||||
});
|
|
||||||
|
|
||||||
var nonimported = new NonImported({
|
|
||||||
root: component.root,
|
|
||||||
store: component.store
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c() {
|
c() {
|
||||||
imported._fragment.c();
|
imported.$$.fragment.c();
|
||||||
text = createText("\n");
|
text = createText("\n");
|
||||||
nonimported._fragment.c();
|
nonimported.$$.fragment.c();
|
||||||
},
|
},
|
||||||
|
|
||||||
m(target, anchor) {
|
m(target, anchor) {
|
||||||
imported._mount(target, anchor);
|
mount_component(imported, target, anchor);
|
||||||
insert(target, text, anchor);
|
insert(target, text, anchor);
|
||||||
nonimported._mount(target, anchor);
|
mount_component(nonimported, target, anchor);
|
||||||
|
current = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o(outrocallback) {
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
outrocallback = callAfter(outrocallback, 2);
|
||||||
|
|
||||||
|
if (imported) imported.$$.fragment.o(outrocallback);
|
||||||
|
if (nonimported) nonimported.$$.fragment.o(outrocallback);
|
||||||
|
current = false;
|
||||||
|
},
|
||||||
|
|
||||||
d(detach) {
|
d(detach) {
|
||||||
imported.destroy(detach);
|
imported.$destroy(detach);
|
||||||
|
|
||||||
if (detach) {
|
if (detach) {
|
||||||
detachNode(text);
|
detachNode(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
nonimported.destroy(detach);
|
nonimported.$destroy(detach);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
init(this, options);
|
constructor(options) {
|
||||||
this._state = assign({}, options.data);
|
super();
|
||||||
this._intro = true;
|
init(this, options, noop, create_fragment, safe_not_equal);
|
||||||
|
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
|
||||||
|
|
||||||
if (options.target) {
|
|
||||||
this._fragment.c();
|
|
||||||
this._mount(options.target, options.anchor);
|
|
||||||
|
|
||||||
flush(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
@ -1,50 +1,32 @@
|
|||||||
/* generated by Svelte vX.Y.Z */
|
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||||
import { assign, init, noop, proto } from "svelte/shared.js";
|
import { SvelteComponent as SvelteComponent_1, init, noop, run, safe_not_equal } from "svelte/internal.js";
|
||||||
|
|
||||||
var methods = {
|
export const SOME_CONSTANT = 42;
|
||||||
foo ( bar ) {
|
|
||||||
console.log( bar );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function setup(Component) {
|
function foo(bar) {
|
||||||
Component.SOME_CONSTANT = 42;
|
console.log(bar);
|
||||||
Component.factory = function (target) {
|
|
||||||
return new Component({
|
|
||||||
target: target
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Component.prototype.foo( 'baz' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_main_fragment(component, ctx) {
|
function create_fragment(component, ctx) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
c: noop,
|
c: noop,
|
||||||
|
|
||||||
m: noop,
|
m: noop,
|
||||||
|
|
||||||
p: noop,
|
p: noop,
|
||||||
|
i: noop,
|
||||||
|
o: run,
|
||||||
d: noop
|
d: noop
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function SvelteComponent(options) {
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
init(this, options);
|
constructor(options) {
|
||||||
this._state = assign({}, options.data);
|
super();
|
||||||
this._intro = true;
|
init(this, options, define, create_fragment, safe_not_equal);
|
||||||
|
}
|
||||||
this._fragment = create_main_fragment(this, this._state);
|
|
||||||
|
|
||||||
if (options.target) {
|
get foo() {
|
||||||
this._fragment.c();
|
return foo;
|
||||||
this._mount(options.target, options.anchor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(SvelteComponent.prototype, proto);
|
|
||||||
assign(SvelteComponent.prototype, methods);
|
|
||||||
|
|
||||||
setup(SvelteComponent);
|
|
||||||
export default SvelteComponent;
|
export default SvelteComponent;
|
Loading…
Reference in new issue