{"version":3,"file":"index.mjs","sources":["../../../../packages/overlay/rectangle/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 TdtRectangle = defineComponent({\r\n  name: \"TdtRectangle\",\r\n  props: PROPS,\r\n  emits: EVENTS,\r\n  setup(props, { emit }) {\r\n    onBeforeMount(async () => {\r\n      onUnmounted(() => tdtComponent && tdtMap?.removeOverLay(tdtComponent));\r\n\r\n      const tdtMap = await useMapRoot();\r\n      const tdtComponent = useInit(props);\r\n      tdtMap.addOverLay(tdtComponent);\r\n      useEvent({ events: NATIVE_EVENTS, emit, instance: tdtComponent, extData: props.extData });\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 TdtRectangleInstance = InstanceType<typeof TdtRectangle>;\r\n"],"names":["TdtRectangle","defineComponent","PROPS","EVENTS","props","emit","onBeforeMount","onUnmounted","tdtComponent","tdtMap","useMapRoot","useInit","useEvent","NATIVE_EVENTS","useWatch"],"mappings":";;;;;;AAKO,MAAMA,IAAeC,EAAgB;AAAA,EAC1C,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,cAAcD,GAAa;AAE/D,YAAAC,IAAS,MAAMC,EAAW,GAC1BF,IAAeG,EAAQP,CAAK;AAClC,MAAAK,EAAO,WAAWD,CAAY,GACrBI,EAAA,EAAE,QAAQC,GAAe,MAAAR,GAAM,UAAUG,GAAc,SAASJ,EAAM,SAAS,GACxFU,EAAS,EAAE,OAAAV,GAAO,UAAUI,EAAA,CAAc,GAC1CH,EAAK,QAAQG,CAAY;AAAA,IAAA,CAC1B,GAEM,MAAM;AAAA,IAAC;AAAA,EAAA;AAElB,CAAC;"}