|
|
@ -149,6 +149,14 @@ function callAll(fns) {
|
|
|
|
while (fns && fns.length) fns.pop()();
|
|
|
|
while (fns && fns.length) fns.pop()();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _mount(target, anchor) {
|
|
|
|
|
|
|
|
this._fragment.mount(target, anchor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _unmount() {
|
|
|
|
|
|
|
|
this._fragment.unmount();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var proto = {
|
|
|
|
var proto = {
|
|
|
|
destroy: destroy,
|
|
|
|
destroy: destroy,
|
|
|
|
get: get,
|
|
|
|
get: get,
|
|
|
@ -158,7 +166,9 @@ var proto = {
|
|
|
|
set: set,
|
|
|
|
set: set,
|
|
|
|
teardown: destroy,
|
|
|
|
teardown: destroy,
|
|
|
|
_recompute: noop,
|
|
|
|
_recompute: noop,
|
|
|
|
_set: _set
|
|
|
|
_set: _set,
|
|
|
|
|
|
|
|
_mount: _mount,
|
|
|
|
|
|
|
|
_unmount: _unmount
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function create_main_fragment ( state, component ) {
|
|
|
|
function create_main_fragment ( state, component ) {
|
|
|
@ -211,7 +221,7 @@ class SvelteComponent extends HTMLElement {
|
|
|
|
this._bind = options._bind;
|
|
|
|
this._bind = options._bind;
|
|
|
|
|
|
|
|
|
|
|
|
this.attachShadow({ mode: 'open' });
|
|
|
|
this.attachShadow({ mode: 'open' });
|
|
|
|
this.shadowRoot.innerHTML = '<style>h1{color:red}</style>';
|
|
|
|
this.shadowRoot.innerHTML = `<style>h1{color:red}</style>`;
|
|
|
|
|
|
|
|
|
|
|
|
this._fragment = create_main_fragment( this._state, this );
|
|
|
|
this._fragment = create_main_fragment( this._state, this );
|
|
|
|
|
|
|
|
|
|
|
@ -239,7 +249,15 @@ class SvelteComponent extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
customElements.define('custom-element', SvelteComponent);
|
|
|
|
customElements.define('custom-element', SvelteComponent);
|
|
|
|
|
|
|
|
assign( SvelteComponent.prototype, proto , {
|
|
|
|
assign( SvelteComponent.prototype, proto );
|
|
|
|
_mount(target, anchor) {
|
|
|
|
|
|
|
|
this._fragment.mount(this.shadowRoot, null);
|
|
|
|
|
|
|
|
target.insertBefore(this, anchor);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_unmount() {
|
|
|
|
|
|
|
|
this.parentNode.removeChild(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default SvelteComponent;
|
|
|
|
export default SvelteComponent;
|
|
|
|