feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
import { TypeComponentsMap } from "../../../utils/vue/icon.js";
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/alert/src/alert.d.ts
declare const alertEffects: readonly ["light", "dark"];
interface AlertProps {
/**
* @description alert title.
*/
title?: string;
/**
* @description descriptive text.
*/
description?: string;
/**
* @description alert type.
*/
type?: keyof typeof TypeComponentsMap;
/**
* @description whether alert can be dismissed.
*/
closable?: boolean;
/**
* @description text for replacing x button
*/
closeText?: string;
/**
* @description whether show icon
*/
showIcon?: boolean;
/**
* @description should content be placed in center.
*/
center?: boolean;
/**
* @description theme style
*/
effect?: 'light' | 'dark';
}
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
declare const alertProps: {
readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: EpPropFinalized<StringConstructor, "error" | "info" | "primary" | "success" | "warning", unknown, "info", boolean>;
readonly closable: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: EpPropFinalized<StringConstructor, "light" | "dark", unknown, "light", boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
type AlertPropsPublic = ExtractPublicPropTypes<typeof alertProps>;
declare const alertEmits: {
close: (evt: MouseEvent) => boolean;
};
type AlertEmits = typeof alertEmits;
//#endregion
export { AlertEmits, AlertProps, AlertPropsPublic, alertEffects, alertEmits, alertProps };
+44
View File
@@ -0,0 +1,44 @@
import { keysOf } from "../../../utils/objects.mjs";
import { buildProps } from "../../../utils/vue/props/runtime.mjs";
import { TypeComponentsMap } from "../../../utils/vue/icon.mjs";
//#region ../../packages/components/alert/src/alert.ts
const alertEffects = ["light", "dark"];
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
const alertProps = buildProps({
title: {
type: String,
default: ""
},
description: {
type: String,
default: ""
},
type: {
type: String,
values: keysOf(TypeComponentsMap),
default: "info"
},
closable: {
type: Boolean,
default: true
},
closeText: {
type: String,
default: ""
},
showIcon: Boolean,
center: Boolean,
effect: {
type: String,
values: alertEffects,
default: "light"
}
});
const alertEmits = { close: (evt) => evt instanceof MouseEvent };
//#endregion
export { alertEffects, alertEmits, alertProps };
//# sourceMappingURL=alert.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"alert.mjs","names":[],"sources":["../../../../../../packages/components/alert/src/alert.ts"],"sourcesContent":["import { TypeComponentsMap, buildProps, keysOf } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\n\nexport const alertEffects = ['light', 'dark'] as const\n\nexport interface AlertProps {\n /**\n * @description alert title.\n */\n title?: string\n /**\n * @description descriptive text.\n */\n description?: string\n /**\n * @description alert type.\n */\n type?: keyof typeof TypeComponentsMap\n /**\n * @description whether alert can be dismissed.\n */\n closable?: boolean\n /**\n * @description text for replacing x button\n */\n closeText?: string\n /**\n * @description whether show icon\n */\n showIcon?: boolean\n /**\n * @description should content be placed in center.\n */\n center?: boolean\n /**\n * @description theme style\n */\n effect?: 'light' | 'dark'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `AlertProps` instead.\n */\nexport const alertProps = buildProps({\n /**\n * @description alert title.\n */\n title: {\n type: String,\n default: '',\n },\n description: {\n type: String,\n default: '',\n },\n /**\n * @description alert type.\n */\n type: {\n type: String,\n values: keysOf(TypeComponentsMap),\n default: 'info',\n },\n /**\n * @description whether alert can be dismissed.\n */\n closable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description text for replacing x button\n */\n closeText: {\n type: String,\n default: '',\n },\n /**\n * @description whether show icon\n */\n showIcon: Boolean,\n /**\n * @description should content be placed in center.\n */\n center: Boolean,\n effect: {\n type: String,\n values: alertEffects,\n default: 'light',\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `AlertProps` instead.\n */\nexport type AlertPropsPublic = ExtractPublicPropTypes<typeof alertProps>\n\nexport const alertEmits = {\n close: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type AlertEmits = typeof alertEmits\n"],"mappings":";;;;;AAIA,MAAa,eAAe,CAAC,SAAS,OAAO;;;;AAwC7C,MAAa,aAAa,WAAW;CAInC,OAAO;EACL,MAAM;EACN,SAAS;EACV;CACD,aAAa;EACX,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ,OAAO,kBAAkB;EACjC,SAAS;EACV;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,UAAU;CAIV,QAAQ;CACR,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,SAAS;EACV;CACF,CAAU;AAOX,MAAa,aAAa,EACxB,QAAQ,QAAoB,eAAe,YAC5C"}
@@ -0,0 +1,35 @@
import { TypeComponentsMap } from "../../../utils/vue/icon.js";
import "../../../utils/index.js";
import { AlertProps } from "./alert.js";
import * as vue from "vue";
//#region ../../packages/components/alert/src/alert.vue.d.ts
declare var __VLS_13: {}, __VLS_20: {}, __VLS_22: {};
type __VLS_Slots = {} & {
icon?: (props: typeof __VLS_13) => any;
} & {
title?: (props: typeof __VLS_20) => any;
} & {
default?: (props: typeof __VLS_22) => any;
};
declare const __VLS_base: vue.DefineComponent<AlertProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
close: (evt: MouseEvent) => void;
}, string, vue.PublicProps, Readonly<AlertProps> & Readonly<{
onClose?: ((evt: MouseEvent) => any) | undefined;
}>, {
type: keyof typeof TypeComponentsMap;
title: string;
description: string;
closable: boolean;
closeText: string;
effect: "light" | "dark";
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default };
@@ -0,0 +1,81 @@
import { TypeComponents, TypeComponentsMap } from "../../../utils/vue/icon.mjs";
import { flattedChildren, isComment } from "../../../utils/vue/vnode.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { alertEmits, alertProps } from "./alert.mjs";
import { ElIcon } from "../../icon/index.mjs";
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, unref, useSlots, vShow, withCtx, withDirectives } from "vue";
//#region ../../packages/components/alert/src/alert.vue?vue&type=script&setup=true&lang.ts
var alert_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElAlert",
__name: "alert",
props: alertProps,
emits: alertEmits,
setup(__props, { emit: __emit }) {
const { Close } = TypeComponents;
const props = __props;
const emit = __emit;
const slots = useSlots();
const ns = useNamespace("alert");
const visible = ref(true);
const iconComponent = computed(() => TypeComponentsMap[props.type]);
const hasDesc = computed(() => {
if (props.description) return true;
const slotContent = slots.default?.();
if (!slotContent) return false;
return flattedChildren(slotContent).some((child) => !isComment(child));
});
const close = (evt) => {
visible.value = false;
emit("close", evt);
};
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, {
name: unref(ns).b("fade"),
persisted: ""
}, {
default: withCtx(() => [withDirectives(createElementVNode("div", {
class: normalizeClass([
unref(ns).b(),
unref(ns).m(__props.type),
unref(ns).is("center", __props.center),
unref(ns).is(__props.effect)
]),
role: "alert"
}, [__props.showIcon && (_ctx.$slots.icon || iconComponent.value) ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(ns).e("icon"), unref(ns).is("big", hasDesc.value)])
}, {
default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))])]),
_: 3
}, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [
__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass([unref(ns).e("title"), { "with-description": hasDesc.value }])
}, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true),
hasDesc.value ? (openBlock(), createElementBlock("p", {
key: 1,
class: normalizeClass(unref(ns).e("description"))
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 2)) : createCommentVNode("v-if", true),
__props.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.closeText ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
onClick: close
}, toDisplayString(__props.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass(unref(ns).e("close-btn")),
onClick: close
}, {
default: withCtx(() => [createVNode(unref(Close))]),
_: 1
}, 8, ["class"]))], 64)) : createCommentVNode("v-if", true)
], 2)], 2), [[vShow, visible.value]])]),
_: 3
}, 8, ["name"]);
};
}
});
//#endregion
export { alert_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=alert.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"alert.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../../../../packages/components/alert/src/alert.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"visible\"\n :class=\"[ns.b(), ns.m(type), ns.is('center', center), ns.is(effect)]\"\n role=\"alert\"\n >\n <el-icon\n v-if=\"showIcon && ($slots.icon || iconComponent)\"\n :class=\"[ns.e('icon'), ns.is('big', hasDesc)]\"\n >\n <slot name=\"icon\">\n <component :is=\"iconComponent\" />\n </slot>\n </el-icon>\n\n <div :class=\"ns.e('content')\">\n <span\n v-if=\"title || $slots.title\"\n :class=\"[ns.e('title'), { 'with-description': hasDesc }]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </span>\n <p v-if=\"hasDesc\" :class=\"ns.e('description')\">\n <slot>\n {{ description }}\n </slot>\n </p>\n <template v-if=\"closable\">\n <div\n v-if=\"closeText\"\n :class=\"[ns.e('close-btn'), ns.is('customed')]\"\n @click=\"close\"\n >\n {{ closeText }}\n </div>\n <el-icon v-else :class=\"ns.e('close-btn')\" @click=\"close\">\n <Close />\n </el-icon>\n </template>\n </div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n TypeComponents,\n TypeComponentsMap,\n flattedChildren,\n isComment,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { alertEmits } from './alert'\n\nimport type { AlertProps } from './alert'\n\nconst { Close } = TypeComponents\n\ndefineOptions({\n name: 'ElAlert',\n})\n\nconst props = withDefaults(defineProps<AlertProps>(), {\n title: '',\n description: '',\n type: 'info',\n closable: true,\n closeText: '',\n effect: 'light',\n})\nconst emit = defineEmits(alertEmits)\nconst slots = useSlots()\n\nconst ns = useNamespace('alert')\n\nconst visible = ref(true)\n\nconst iconComponent = computed(() => TypeComponentsMap[props.type])\n\nconst hasDesc = computed(() => {\n if (props.description) return true\n const slotContent = slots.default?.()\n if (!slotContent) return false\n\n const children = flattedChildren(slotContent)\n return children.some((child) => !isComment(child))\n})\n\nconst close = (evt: MouseEvent) => {\n visible.value = false\n emit('close', evt)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;EA2DA,MAAM,EAAE,UAAU;EAMlB,MAAM,QAAQ;EAQd,MAAM,OAAO;EACb,MA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AqC,KAAA,QAAA,SAAA,EAAA,QAAA,iCAAf,QAAA,MAAK,EAAA,EAAA;KAEpB,QAAA,sBAAT,mBAII,KAAA;;MAJe,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,cAAA,CAAA;SAC5B,WAEO,KAAA,QAAA,WAAA,EAAA,QAAA,iCADF,QAAA,YAAW,EAAA,EAAA;KAGF,QAAA,yBAAhB,mBAWW,UAAA,EAAA,KAAA,GAAA,EAAA,CATD,QAAA,0BADR,mBAMM,OAAA;;MAJH,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,YAAA,EAAe,MAAA,GAAE,CAAC,GAAE,WAAA,CAAA,CAAA;MAChC,SAAO;wBAEL,QAAA,UAAS,EAAA,EAAA,kBAEd,YAEU,MAAA,OAAA,EAAA;;MAFO,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,YAAA,CAAA;MAAgB,SAAO;;6BACxC,CAAT,YAAS,MAAA,MAAA,CAAA;;;yBAlCP,QAAA,MAAO"}
@@ -0,0 +1,8 @@
import alert_vue_vue_type_script_setup_true_lang_default from "./alert.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/alert/src/alert.vue
var alert_default = alert_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { alert_default as default };
//# sourceMappingURL=alert2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"alert2.mjs","names":[],"sources":["../../../../../../packages/components/alert/src/alert.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"visible\"\n :class=\"[ns.b(), ns.m(type), ns.is('center', center), ns.is(effect)]\"\n role=\"alert\"\n >\n <el-icon\n v-if=\"showIcon && ($slots.icon || iconComponent)\"\n :class=\"[ns.e('icon'), ns.is('big', hasDesc)]\"\n >\n <slot name=\"icon\">\n <component :is=\"iconComponent\" />\n </slot>\n </el-icon>\n\n <div :class=\"ns.e('content')\">\n <span\n v-if=\"title || $slots.title\"\n :class=\"[ns.e('title'), { 'with-description': hasDesc }]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </span>\n <p v-if=\"hasDesc\" :class=\"ns.e('description')\">\n <slot>\n {{ description }}\n </slot>\n </p>\n <template v-if=\"closable\">\n <div\n v-if=\"closeText\"\n :class=\"[ns.e('close-btn'), ns.is('customed')]\"\n @click=\"close\"\n >\n {{ closeText }}\n </div>\n <el-icon v-else :class=\"ns.e('close-btn')\" @click=\"close\">\n <Close />\n </el-icon>\n </template>\n </div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n TypeComponents,\n TypeComponentsMap,\n flattedChildren,\n isComment,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { alertEmits } from './alert'\n\nimport type { AlertProps } from './alert'\n\nconst { Close } = TypeComponents\n\ndefineOptions({\n name: 'ElAlert',\n})\n\nconst props = withDefaults(defineProps<AlertProps>(), {\n title: '',\n description: '',\n type: 'info',\n closable: true,\n closeText: '',\n effect: 'light',\n})\nconst emit = defineEmits(alertEmits)\nconst slots = useSlots()\n\nconst ns = useNamespace('alert')\n\nconst visible = ref(true)\n\nconst iconComponent = computed(() => TypeComponentsMap[props.type])\n\nconst hasDesc = computed(() => {\n if (props.description) return true\n const slotContent = slots.default?.()\n if (!slotContent) return false\n\n const children = flattedChildren(slotContent)\n return children.some((child) => !isComment(child))\n})\n\nconst close = (evt: MouseEvent) => {\n visible.value = false\n emit('close', evt)\n}\n</script>\n"],"mappings":""}
@@ -0,0 +1,6 @@
import { _default } from "./alert.vue.js";
//#region ../../packages/components/alert/src/instance.d.ts
type AlertInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { AlertInstance };