UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.39 kB
{"version":3,"file":"index.mjs","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"],"names":[],"mappings":";;;AAcO,MAAM,aAAA,GAAgB,CAC3B,EAAE,IAAA,EAAM,WAAA,EAAa,KAAA,EAAO,OAAA,EAAS,GAAA,EAAK,IAAA,GAAO,KAAA,EAAM,EACvD,SAAA,KACG;AACH,EAAA,KAAA;AAAA,IACE,MAAM,MAAM,SAAS,CAAA;AAAA,IACrB,CAAC,GAAA,KAAQ;AACP,MAAA,IAAI,GAAA,EAAK;AACP,QAAA,SAAA;AAAA,UACE,KAAA;AAAA,UACA,IAAI,IAAI,CAAA,EAAA,EAAK,IAAI,CAAA,sCAAA,EAAyC,OAAO,gBAAgB,WAAW,CAAA;AAAA,+BAAA,EACrE,GAAG;AAAA;AAAA,SAE5B;AAAA,MACF;AAAA,IACF,CAAA;AAAA,IACA;AAAA,MACE,SAAA,EAAW;AAAA;AACb,GACF;AACF;;;;"}