{"version":3,"file":"useRtl-DpwU_RM8.mjs","names":[],"sources":["../src/composables/useRtl.ts"],"sourcesContent":["import {inject, onMounted, watch} from 'vue'\nimport {rtlRegistryKey} from '../utils/keys'\nimport {getSafeDocument} from '../utils/dom'\n\nexport const useRtl = () => {\n  const rtlPlugin = inject(rtlRegistryKey, null)\n\n  onMounted(() => {\n    // I can't think of a reason why one might want to destroy these if unmounted...\n    watch(\n      () => rtlPlugin?.locale.value,\n      (newValue) => {\n        getSafeDocument()?.documentElement.setAttribute('lang', newValue ?? '')\n      },\n      {immediate: true}\n    )\n\n    watch(\n      () => rtlPlugin?.isRtl.value,\n      (newValue) => {\n        getSafeDocument()?.documentElement.setAttribute('dir', (newValue ?? false) ? 'rtl' : 'ltr')\n      },\n      {immediate: true}\n    )\n  })\n\n  return {...rtlPlugin}\n}\n"],"mappings":";;;;AAIA,IAAa,eAAe;CAC1B,MAAM,YAAY,OAAO,gBAAgB,KAAK;AAE9C,iBAAgB;AAEd,cACQ,WAAW,OAAO,QACvB,aAAa;AACZ,oBAAiB,EAAE,gBAAgB,aAAa,QAAQ,YAAY,GAAG;KAEzE,EAAC,WAAW,MAAK,CAClB;AAED,cACQ,WAAW,MAAM,QACtB,aAAa;AACZ,oBAAiB,EAAE,gBAAgB,aAAa,OAAQ,YAAY,QAAS,QAAQ,MAAM;KAE7F,EAAC,WAAW,MAAK,CAClB;GACD;AAEF,QAAO,EAAC,GAAG,WAAU"}