{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-deprecated/index.ts"],"sourcesContent":["import { unref, watch } from 'vue'\r\nimport { debugWarn } from '@sgui-plus/utils/error'\r\n\r\nimport type { MaybeRef } from '@vueuse/core'\r\n\r\ntype DeprecationParam = {\r\n  from: string\r\n  replacement: string\r\n  scope: string\r\n  version: string\r\n  ref: string\r\n  type?: 'API' | 'Slot' | 'Event'\r\n}\r\n\r\nexport const useDeprecated = (\r\n  { from, replacement, scope, version, ref, type = 'API' }: DeprecationParam,\r\n  condition: MaybeRef<boolean>\r\n) => {\r\n  watch(\r\n    () => unref(condition),\r\n    (val) => {\r\n      if (val) {\r\n        debugWarn(\r\n          scope,\r\n          `${type} ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.\r\nFor more detail, please visit: ${ref}\r\n`\r\n        )\r\n      }\r\n    },\r\n    {\r\n      immediate: true,\r\n    }\r\n  )\r\n}\r\n"],"names":[],"mappings":";;;AAEY,MAAC,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,EAAE,SAAS,KAAK;AACtG,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK;AACzC,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC;AAClH,+BAA+B,EAAE,GAAG,CAAC;AACrC,CAAC,CAAC,CAAC;AACH,KAAK;AACL,GAAG,EAAE;AACL,IAAI,SAAS,EAAE,IAAI;AACnB,GAAG,CAAC,CAAC;AACL;;;;"}