2023-06-25 21:34:27 +07:00
|
|
|
|
|
|
|
(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, m as detach_dev, u as binding_callbacks } from './index-9ff7cb25.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 };
|