{"version":3,"file":"index.cjs","sources":["../../../src/html-components/leaflet-map/index.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"Datum extends GenericDataRecord\">\n// !!! This code was automatically generated. You should not change it !!!\nimport { LeafletMap, LeafletMapConfigInterface, GenericDataRecord, MapLibreStyleSpecs } from '@unovis/ts'\nimport { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue'\nimport { arePropsEqual, useForwardProps } from '../../utils/props'\n\n\n// data and required props \ntype Props = LeafletMapConfigInterface<Datum>\nconst props = defineProps<Props & { data?: Datum[] }>()\n\nconst data = computed(() => props.data)\n// config\nconst config = useForwardProps(props)\n\n// component declaration\nconst component = ref<LeafletMap<Datum>>()\nconst elRef = ref<HTMLDivElement>()\n\nonMounted(() => {\n  nextTick(() => {\n    if(elRef.value)\n    component.value = new LeafletMap<Datum>(elRef.value, config.value, data.value)\n    \n    \n  })\n})\n\nonUnmounted(() => {\n  component.value?.destroy()\n  \n})\n\nwatch(config, (curr, prev) => {\n  if (!arePropsEqual(curr, prev)) {\n    component.value?.setConfig(config.value)\n    component.value?.render()\n  }\n})\n\nwatch(data, () => {\n  component.value?.setData(data.value)\n})\n\ndefineExpose({\n  component\n})\n</script>\n\n<script lang=\"ts\">\nexport const VisLeafletMapSelectors = LeafletMap.selectors\n</script>\n\n<template>\n  <div data-vis-leaflet-map ref=\"elRef\"/>\n</template>\n\n\n<style>\n  [data-vis-leaflet-map] {\n    display:block;\n    position:relative;\n  }\n</style>\n"],"names":["VisLeafletMapSelectors","LeafletMap","props","__props","data","computed","config","useForwardProps","component","ref","elRef","onMounted","nextTick","onUnmounted","watch","curr","prev","arePropsEqual","__expose","_createElementBlock"],"mappings":"8LAkDaA,EAAyBC,EAAAA,WAAW,w5CAzCjD,MAAMC,EAAQC,EAERC,EAAOC,EAAAA,SAAS,IAAMH,EAAM,IAAI,EAEhCI,EAASC,EAAAA,gBAAgBL,CAAK,EAG9BM,EAAYC,EAAAA,IAAA,EACZC,EAAQD,EAAAA,IAAA,EAEdE,OAAAA,EAAAA,UAAU,IAAM,CACdC,EAAAA,SAAS,IAAM,CACVF,EAAM,QACTF,EAAU,MAAQ,IAAIP,EAAAA,WAAkBS,EAAM,MAAOJ,EAAO,MAAOF,EAAK,KAAK,EAG/E,CAAC,CACH,CAAC,EAEDS,EAAAA,YAAY,IAAM,CAChBL,EAAU,OAAO,QAAA,CAEnB,CAAC,EAEDM,EAAAA,MAAMR,EAAQ,CAACS,EAAMC,IAAS,CACvBC,EAAAA,cAAcF,EAAMC,CAAI,IAC3BR,EAAU,OAAO,UAAUF,EAAO,KAAK,EACvCE,EAAU,OAAO,OAAA,EAErB,CAAC,EAEDM,EAAAA,MAAMV,EAAM,IAAM,CAChBI,EAAU,OAAO,QAAQJ,EAAK,KAAK,CACrC,CAAC,EAEDc,EAAa,CACX,UAAAV,CAAA,CACD,wBAQCW,EAAAA,mBAAuC,MAAA,CAAlC,uBAAA,WAAyB,QAAJ,IAAIT,CAAA"}