element-plus
Version:
A Component Library for Vue 3
1 lines • 1.15 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../packages/hooks/use-deprecated/index.ts"],"sourcesContent":["import { unref, watch } from 'vue'\nimport { debugWarn } from '@element-plus/utils'\n\nimport type { MaybeRef } from '@vueuse/core'\n\ntype DeprecationParam = {\n from: string\n replacement: string\n scope: string\n version: string\n ref: string\n type?: 'API' | 'Attribute' | 'Event' | 'Slot'\n}\n\nexport const useDeprecated = (\n { from, replacement, scope, version, ref, type = 'API' }: 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"],"mappings":";;;;AAcA,MAAa,iBACX,EAAE,MAAM,aAAa,OAAO,SAAS,KAAK,OAAO,SACjD,cACG;AACH,aACQ,MAAM,UAAU,GACrB,QAAQ;AACP,MAAI,IACF,WACE,OACA,IAAI,KAAK,IAAI,KAAK,wCAAwC,QAAQ,eAAe,YAAY;iCACtE,IAAI;EAE5B;IAGL,EACE,WAAW,MACZ,CACF"}