{"version":3,"file":"index.mjs","sources":["../../../../packages/tilelayer/gridlineLayer/index.ts"],"sourcesContent":["import { defineComponent, onBeforeMount, onUnmounted } from \"vue\";\r\nimport { useMapRoot } from \"~/use/mapRoot\";\r\nimport { useEvent } from \"~/use/event\";\r\nimport { EVENTS, NATIVE_EVENTS, PROPS, useInit, useWatch } from \"./use\";\r\n\r\nexport const TdtGridlineLayer = defineComponent({\r\n  name: \"TdtGridlineLayer\",\r\n  props: PROPS,\r\n  emits: EVENTS,\r\n  setup(props, { emit }) {\r\n    onBeforeMount(async () => {\r\n      onUnmounted(() => tdtComponent && tdtMap?.removeLayer(tdtComponent));\r\n\r\n      const tdtMap = await useMapRoot();\r\n      const tdtComponent = useInit(props);\r\n      tdtMap.addLayer(tdtComponent);\r\n      useEvent({ events: NATIVE_EVENTS, emit, instance: tdtComponent });\r\n      useWatch({ props, instance: tdtComponent });\r\n      emit(\"init\", tdtComponent);\r\n    });\r\n\r\n    return () => {};\r\n  }\r\n});\r\n\r\nexport type TdtGridlineLayerInstance = InstanceType<typeof TdtGridlineLayer>;\r\n"],"names":["TdtGridlineLayer","defineComponent","PROPS","EVENTS","props","emit","onBeforeMount","onUnmounted","tdtComponent","tdtMap","useMapRoot","useInit","useEvent","NATIVE_EVENTS","useWatch"],"mappings":";;;;;;AAKO,MAAMA,IAAmBC,EAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,MAAMC,GAAO,EAAE,MAAAC,KAAQ;AACrB,WAAAC,EAAc,YAAY;AACxB,MAAAC,EAAY,MAAMC,MAAgBC,KAAA,gBAAAA,EAAQ,YAAYD,GAAa;AAE7D,YAAAC,IAAS,MAAMC,EAAW,GAC1BF,IAAeG,EAAQP,CAAK;AAClC,MAAAK,EAAO,SAASD,CAAY,GAC5BI,EAAS,EAAE,QAAQC,GAAe,MAAAR,GAAM,UAAUG,GAAc,GAChEM,EAAS,EAAE,OAAAV,GAAO,UAAUI,EAAA,CAAc,GAC1CH,EAAK,QAAQG,CAAY;AAAA,IAAA,CAC1B,GAEM,MAAM;AAAA,IAAC;AAAA,EAAA;AAElB,CAAC;"}