{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-deprecated/index.ts"],"sourcesContent":["import { unref, watch } from 'vue'\nimport { debugWarn } from '@vuesax-alpha/utils'\n\nimport type { MaybeRef } from '@vuesax-alpha/utils'\n\ntype DeprecationParam = {\n  from: string\n  replacement: string\n  scope: string\n  version: string\n  ref: string\n  type?: 'API' | 'Attribute' | 'Event' | 'Slot' | 'Prop'\n}\n\n/**\n * scope, type, from, version, replacement, ref\n */\nexport const useDeprecated = (\n  { scope, type = 'API', from, version, replacement, ref }: DeprecationParam,\n  condition: MaybeRef<boolean>\n) => {\n  watch(\n    () => unref(condition),\n    (val) => {\n      if (val) {\n        debugWarn(\n          scope,\n          `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.\nFor more detail, please visit: ${ref}\n`\n        )\n      }\n    },\n    {\n      immediate: true,\n    }\n  )\n}\n"],"names":[],"mappings":";;;;AAiBa,MAAA,aAAA,GAAgB,CAC3B,EAAE,KAAO,EAAA,IAAA,GAAO,KAAO,EAAA,IAAA,EAAM,OAAS,EAAA,WAAA,EAAa,GAAI,EAAA,EACvD,SACG,KAAA;AACH,EAAA,KAAA;AAAA,IACE,MAAM,MAAM,SAAS,CAAA;AAAA,IACrB,CAAC,GAAQ,KAAA;AACP,MAAA,IAAI,GAAK,EAAA;AACP,QAAA,SAAA;AAAA,UACE,KAAA;AAAA,UACA,CAAA,CAAA,EAAI,IAAS,CAAA,EAAA,EAAA,IAAA,CAAA,sCAAA,EAA6C,OAAuB,CAAA,aAAA,EAAA,WAAA,CAAA;AAAA,+BAC1D,EAAA,GAAA,CAAA;AAAA,CAAA;AAAA,SAEzB,CAAA;AAAA,OACF;AAAA,KACF;AAAA,IACA;AAAA,MACE,SAAW,EAAA,IAAA;AAAA,KACb;AAAA,GACF,CAAA;AACF;;;;"}