Update
This commit is contained in:
@@ -1,152 +1 @@
|
||||
|
||||
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
|
||||
import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, q as flush, s as safe_not_equal, d as dispatch_dev, c as validate_slots, o as onMount, e as element, n as noop, h as attr_dev, g as add_location, l as detach_dev, u as binding_callbacks } from './index-3b678a7c.js';
|
||||
|
||||
/* src\components\map-component.svelte generated by Svelte v3.52.0 */
|
||||
const file = "src\\components\\map-component.svelte";
|
||||
|
||||
function create_fragment(ctx) {
|
||||
let div;
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
div = element("div");
|
||||
this.c = noop;
|
||||
attr_dev(div, "id", "map");
|
||||
add_location(div, file, 30, 0, 720);
|
||||
},
|
||||
l: function claim(nodes) {
|
||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
insert_dev(target, div, anchor);
|
||||
/*div_binding*/ ctx[2](div);
|
||||
},
|
||||
p: noop,
|
||||
i: noop,
|
||||
o: noop,
|
||||
d: function destroy(detaching) {
|
||||
if (detaching) detach_dev(div);
|
||||
/*div_binding*/ ctx[2](null);
|
||||
}
|
||||
};
|
||||
|
||||
dispatch_dev("SvelteRegisterBlock", {
|
||||
block,
|
||||
id: create_fragment.name,
|
||||
type: "component",
|
||||
source: "",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
function instance($$self, $$props, $$invalidate) {
|
||||
let { $$slots: slots = {}, $$scope } = $$props;
|
||||
validate_slots('map-component', slots, []);
|
||||
let { callback = null } = $$props;
|
||||
|
||||
// Main code
|
||||
let mapContainer;
|
||||
|
||||
function createMap(center, zoom) {
|
||||
let map = L.map(mapContainer, { center, zoom });
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
callback(createMap);
|
||||
});
|
||||
|
||||
const writable_props = ['callback'];
|
||||
|
||||
Object.keys($$props).forEach(key => {
|
||||
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<map-component> was created with unknown prop '${key}'`);
|
||||
});
|
||||
|
||||
function div_binding($$value) {
|
||||
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
||||
mapContainer = $$value;
|
||||
$$invalidate(0, mapContainer);
|
||||
});
|
||||
}
|
||||
|
||||
$$self.$$set = $$props => {
|
||||
if ('callback' in $$props) $$invalidate(1, callback = $$props.callback);
|
||||
};
|
||||
|
||||
$$self.$capture_state = () => ({
|
||||
onMount,
|
||||
callback,
|
||||
mapContainer,
|
||||
createMap
|
||||
});
|
||||
|
||||
$$self.$inject_state = $$props => {
|
||||
if ('callback' in $$props) $$invalidate(1, callback = $$props.callback);
|
||||
if ('mapContainer' in $$props) $$invalidate(0, mapContainer = $$props.mapContainer);
|
||||
};
|
||||
|
||||
if ($$props && "$$inject" in $$props) {
|
||||
$$self.$inject_state($$props.$$inject);
|
||||
}
|
||||
|
||||
return [mapContainer, callback, div_binding];
|
||||
}
|
||||
|
||||
class Map_component extends SvelteElement {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
this.shadowRoot.innerHTML = `<style>@import 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';#map{height:var(--height);width:var(--width,100%);margin-bottom:var(--margin-bottom,0)
|
||||
}</style>`;
|
||||
|
||||
init(
|
||||
this,
|
||||
{
|
||||
target: this.shadowRoot,
|
||||
props: attribute_to_object(this.attributes),
|
||||
customElement: true
|
||||
},
|
||||
instance,
|
||||
create_fragment,
|
||||
safe_not_equal,
|
||||
{ callback: 1 },
|
||||
null
|
||||
);
|
||||
|
||||
if (options) {
|
||||
if (options.target) {
|
||||
insert_dev(options.target, this, options.anchor);
|
||||
}
|
||||
|
||||
if (options.props) {
|
||||
this.$set(options.props);
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get observedAttributes() {
|
||||
return ["callback"];
|
||||
}
|
||||
|
||||
get callback() {
|
||||
return this.$$.ctx[1];
|
||||
}
|
||||
|
||||
set callback(callback) {
|
||||
this.$$set({ callback });
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("map-component", Map_component);
|
||||
|
||||
export { Map_component as default };
|
||||
import{S as t,i as a,a as e,b as s,l as r,s as o,e as n,n as i,d as l,h as c,o as p,r as h}from"./index-95aedb1a.js";function u(t){let a;return{c(){a=n("div"),this.c=i,l(a,"id","map")},m(e,r){s(e,a,r),t[2](a)},p:i,i:i,o:i,d(e){e&&c(a),t[2](null)}}}function m(t,a,e){let s,{callback:r=null}=a;function o(t,a){let e=L.map(s,{center:t,zoom:a});return L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(e),e}return p((()=>{r(o)})),t.$$set=t=>{"callback"in t&&e(1,r=t.callback)},[s,r,function(t){h[t?"unshift":"push"]((()=>{s=t,e(0,s)}))}]}class b extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';#map{height:var(--height);width:var(--width,100%);margin-bottom:var(--margin-bottom,0)\n }</style>",a(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},m,u,o,{callback:1},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),r()))}static get observedAttributes(){return["callback"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),r()}}customElements.define("map-component",b);export{b as default};
|
||||
|
Reference in New Issue
Block a user