first commit
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
import { MaybeRef } from "@vueuse/core";
|
||||
|
||||
//#region ../../packages/hooks/use-deprecated/index.d.ts
|
||||
type DeprecationParam = {
|
||||
from: string;
|
||||
replacement: string;
|
||||
scope: string;
|
||||
version: string;
|
||||
ref: string;
|
||||
type?: 'API' | 'Attribute' | 'Event' | 'Slot';
|
||||
};
|
||||
declare const useDeprecated: ({
|
||||
from,
|
||||
replacement,
|
||||
scope,
|
||||
version,
|
||||
ref,
|
||||
type
|
||||
}: DeprecationParam, condition: MaybeRef<boolean>) => void;
|
||||
//#endregion
|
||||
export { useDeprecated };
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
||||
const require_error = require('../../utils/error.js');
|
||||
let vue = require("vue");
|
||||
|
||||
//#region ../../packages/hooks/use-deprecated/index.ts
|
||||
const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
|
||||
(0, vue.watch)(() => (0, vue.unref)(condition), (val) => {
|
||||
if (val) require_error.debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
|
||||
For more detail, please visit: ${ref}
|
||||
`);
|
||||
}, { immediate: true });
|
||||
};
|
||||
|
||||
//#endregion
|
||||
exports.useDeprecated = useDeprecated;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","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,qCACc,UAAU,GACrB,QAAQ;AACP,MAAI,IACF,yBACE,OACA,IAAI,KAAK,IAAI,KAAK,wCAAwC,QAAQ,eAAe,YAAY;iCACtE,IAAI;EAE5B;IAGL,EACE,WAAW,MACZ,CACF"}
|
||||
Reference in New Issue
Block a user