{"version":3,"file":"index.cjs","sources":["../../../src/components/stacked-bar/index.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"Datum\">\n// !!! This code was automatically generated. You should not change it !!!\nimport { StackedBar, StackedBarConfigInterface, NumericAccessor } from '@unovis/ts'\nimport { onMounted, onUnmounted, computed, ref, watch, nextTick, inject } from 'vue'\nimport { arePropsEqual, useForwardProps } from '../../utils/props'\nimport { componentAccessorKey } from '../../utils/context'\n\nconst accessor = inject(componentAccessorKey)\n\n// data and required props \ntype Props = StackedBarConfigInterface<Datum>\nconst props = defineProps<Props & { data?: Datum[] }>()\n\nconst data = computed(() => accessor.data.value ?? props.data)\n// config\nconst config = useForwardProps(props)\n\n// component declaration\nconst component = ref<StackedBar<Datum>>()\n\n\nonMounted(() => {\n  nextTick(() => {\n    component.value = new StackedBar<Datum>(config.value)\n    component.value?.setData(data.value)\n    accessor.update(component.value)\n  })\n})\n\nonUnmounted(() => {\n  component.value?.destroy()\n  accessor.destroy()\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 VisStackedBarSelectors = StackedBar.selectors\n</script>\n\n<template>\n  <div data-vis-component />\n</template>\n\n\n"],"names":["VisStackedBarSelectors","StackedBar","accessor","inject","componentAccessorKey","props","__props","data","computed","config","useForwardProps","component","ref","onMounted","nextTick","onUnmounted","watch","curr","prev","arePropsEqual","__expose","_openBlock","_createElementBlock","_hoisted_1"],"mappings":"+PAmDaA,EAAyBC,EAAAA,WAAW,6iBA5CjD,MAAMC,EAAWC,EAAAA,OAAOC,sBAAoB,EAItCC,EAAQC,EAERC,EAAOC,EAAAA,SAAS,IAAMN,EAAS,KAAK,OAASG,EAAM,IAAI,EAEvDI,EAASC,EAAAA,gBAAgBL,CAAK,EAG9BM,EAAYC,EAAAA,IAAA,EAGlBC,OAAAA,EAAAA,UAAU,IAAM,CACdC,EAAAA,SAAS,IAAM,CACbH,EAAU,MAAQ,IAAIV,aAAkBQ,EAAO,KAAK,EACpDE,EAAU,OAAO,QAAQJ,EAAK,KAAK,EACnCL,EAAS,OAAOS,EAAU,KAAK,CACjC,CAAC,CACH,CAAC,EAEDI,EAAAA,YAAY,IAAM,CAChBJ,EAAU,OAAO,QAAA,EACjBT,EAAS,QAAA,CACX,CAAC,EAEDc,EAAAA,MAAMP,EAAQ,CAACQ,EAAMC,IAAS,CACvBC,EAAAA,cAAcF,EAAMC,CAAI,IAC3BP,EAAU,OAAO,UAAUF,EAAO,KAAK,EACvCE,EAAU,OAAO,OAAA,EAErB,CAAC,EAEDK,EAAAA,MAAMT,EAAM,IAAM,CAChBI,EAAU,OAAO,QAAQJ,EAAK,KAAK,CACrC,CAAC,EAEDa,EAAa,CACX,UAAAT,CAAA,CACD,UAQCU,YAAA,EAAAC,qBAA0B,MAA1BC,CAA0B"}