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
+9
View File
@@ -0,0 +1,9 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import "../../utils/index.js";
import { LinkConfigContext, LinkEmits, LinkInstance, LinkProps, LinkPropsPublic, linkEmits, linkProps } from "./src/link.js";
import { _default } from "./src/link.vue.js";
//#region ../../packages/components/link/index.d.ts
declare const ElLink: SFCWithInstall<typeof _default>;
//#endregion
export { ElLink, ElLink as default, LinkConfigContext, LinkEmits, LinkInstance, LinkProps, LinkPropsPublic, linkEmits, linkProps };
+10
View File
@@ -0,0 +1,10 @@
import { withInstall } from "../../utils/vue/install.mjs";
import { linkEmits, linkProps } from "./src/link.mjs";
import link_default from "./src/link2.mjs";
//#region ../../packages/components/link/index.ts
const ElLink = withInstall(link_default);
//#endregion
export { ElLink, ElLink as default, linkEmits, linkProps };
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["Link"],"sources":["../../../../../packages/components/link/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Link from './src/link.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElLink: SFCWithInstall<typeof Link> = withInstall(Link)\nexport default ElLink\n\nexport * from './src/link'\n"],"mappings":";;;;;AAKA,MAAa,SAAsC,YAAYA,aAAK"}
+65
View File
@@ -0,0 +1,65 @@
import { IconPropType } from "../../../utils/vue/icon.js";
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import { _default } from "./link.vue.js";
import * as vue from "vue";
import { ExtractPublicPropTypes, PropType } from "vue";
//#region ../../packages/components/link/src/link.d.ts
interface LinkProps {
/**
* @description type
*/
type?: 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'default';
/**
* @description when underlines should appear
*/
underline?: boolean | 'always' | 'never' | 'hover';
/**
* @description whether the component is disabled
*/
disabled?: boolean;
/**
* @description same as native hyperlink's `href`
*/
href?: string;
/**
* @description same as native hyperlink's `target`
*/
target?: '_blank' | '_parent' | '_self' | '_top' | (string & NonNullable<unknown>);
/**
* @description icon component
*/
icon?: IconPropType;
}
/**
* @deprecated Removed after 3.0.0, Use `LinkProps` instead.
*/
declare const linkProps: {
readonly type: EpPropFinalized<StringConstructor, "default" | "info" | "primary" | "success" | "warning" | "danger", unknown, undefined, boolean>;
readonly underline: EpPropFinalized<readonly [BooleanConstructor, StringConstructor], boolean | "always" | "never" | "hover", unknown, undefined, boolean>;
readonly disabled: BooleanConstructor;
readonly href: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly target: EpPropFinalized<(new (...args: any[]) => string) | (() => string) | (((new (...args: any[]) => string) | (() => string)) | null)[], unknown, unknown, "_self", boolean>;
readonly icon: {
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
/**
* @deprecated Removed after 3.0.0, Use `LinkProps` instead.
*/
type LinkPropsPublic = ExtractPublicPropTypes<typeof linkProps>;
declare const linkEmits: {
click: (evt: MouseEvent) => boolean;
};
type LinkEmits = typeof linkEmits;
type LinkInstance = InstanceType<typeof _default> & unknown;
interface LinkConfigContext {
type?: LinkProps['type'];
underline?: LinkProps['underline'];
}
//#endregion
export { LinkConfigContext, LinkEmits, LinkInstance, LinkProps, LinkPropsPublic, linkEmits, linkProps };
+47
View File
@@ -0,0 +1,47 @@
import { buildProps } from "../../../utils/vue/props/runtime.mjs";
import { iconPropType } from "../../../utils/vue/icon.mjs";
//#region ../../packages/components/link/src/link.ts
/**
* @deprecated Removed after 3.0.0, Use `LinkProps` instead.
*/
const linkProps = buildProps({
type: {
type: String,
values: [
"primary",
"success",
"warning",
"info",
"danger",
"default"
],
default: void 0
},
underline: {
type: [Boolean, String],
values: [
true,
false,
"always",
"never",
"hover"
],
default: void 0
},
disabled: Boolean,
href: {
type: String,
default: ""
},
target: {
type: String,
default: "_self"
},
icon: { type: iconPropType }
});
const linkEmits = { click: (evt) => evt instanceof MouseEvent };
//#endregion
export { linkEmits, linkProps };
//# sourceMappingURL=link.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"link.mjs","names":[],"sources":["../../../../../../packages/components/link/src/link.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes, PropType } from 'vue'\nimport type { IconPropType } from '@element-plus/utils'\nimport type Link from './link.vue'\n\nexport interface LinkProps {\n /**\n * @description type\n */\n type?: 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'default'\n /**\n * @description when underlines should appear\n */\n underline?: boolean | 'always' | 'never' | 'hover'\n\n /**\n * @description whether the component is disabled\n */\n disabled?: boolean\n /**\n * @description same as native hyperlink's `href`\n */\n href?: string\n /**\n * @description same as native hyperlink's `target`\n */\n target?:\n | '_blank'\n | '_parent'\n | '_self'\n | '_top'\n | (string & NonNullable<unknown>)\n\n /**\n * @description icon component\n */\n icon?: IconPropType\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `LinkProps` instead.\n */\nexport const linkProps = buildProps({\n /**\n * @description type\n */\n type: {\n type: String,\n values: ['primary', 'success', 'warning', 'info', 'danger', 'default'],\n default: undefined,\n },\n /**\n * @description when underlines should appear\n */\n underline: {\n type: [Boolean, String],\n values: [true, false, 'always', 'never', 'hover'],\n default: undefined,\n },\n /**\n * @description whether the component is disabled\n */\n disabled: Boolean,\n /**\n * @description same as native hyperlink's `href`\n */\n href: { type: String, default: '' },\n /**\n * @description same as native hyperlink's `target`\n */\n target: {\n type: String as PropType<'_blank' | '_parent' | '_self' | '_top' | string>,\n default: '_self',\n },\n /**\n * @description icon component\n */\n icon: {\n type: iconPropType,\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `LinkProps` instead.\n */\nexport type LinkPropsPublic = ExtractPublicPropTypes<typeof linkProps>\n\nexport const linkEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type LinkEmits = typeof linkEmits\n\nexport type LinkInstance = InstanceType<typeof Link> & unknown\nexport interface LinkConfigContext {\n type?: LinkProps['type']\n underline?: LinkProps['underline']\n}\n"],"mappings":";;;;;;;AA2CA,MAAa,YAAY,WAAW;CAIlC,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAW;GAAW;GAAW;GAAQ;GAAU;GAAU;EACtE,SAAS;EACV;CAID,WAAW;EACT,MAAM,CAAC,SAAS,OAAO;EACvB,QAAQ;GAAC;GAAM;GAAO;GAAU;GAAS;GAAQ;EACjD,SAAS;EACV;CAID,UAAU;CAIV,MAAM;EAAE,MAAM;EAAQ,SAAS;EAAI;CAInC,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,MAAM,EACJ,MAAM,cACP;CACF,CAAU;AAOX,MAAa,YAAY,EACvB,QAAQ,QAAoB,eAAe,YAC5C"}
@@ -0,0 +1,29 @@
import { LinkProps } from "./link.js";
import * as vue from "vue";
//#region ../../packages/components/link/src/link.vue.d.ts
declare var __VLS_12: {}, __VLS_14: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_12) => any;
} & {
icon?: (props: typeof __VLS_14) => any;
};
declare const __VLS_base: vue.DefineComponent<LinkProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
click: (evt: MouseEvent) => void;
}, string, vue.PublicProps, Readonly<LinkProps> & Readonly<{
onClick?: ((evt: MouseEvent) => any) | undefined;
}>, {
target: "_blank" | "_parent" | "_self" | "_top" | (string & NonNullable<unknown>);
type: "primary" | "success" | "warning" | "info" | "danger" | "default";
underline: boolean | "always" | "never" | "hover";
href: string;
}, {}, {}, {}, 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,65 @@
import { isBoolean } from "../../../utils/types.mjs";
import { useDeprecated } from "../../../hooks/use-deprecated/index.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { ElIcon } from "../../icon/index.mjs";
import { useGlobalConfig } from "../../config-provider/src/hooks/use-global-config.mjs";
import { linkEmits, linkProps } from "./link.mjs";
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
//#region ../../packages/components/link/src/link.vue?vue&type=script&setup=true&lang.ts
const _hoisted_1 = ["href", "target"];
var link_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElLink",
__name: "link",
props: linkProps,
emits: linkEmits,
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const globalConfig = useGlobalConfig("link");
useDeprecated({
scope: "el-link",
from: "The underline option (boolean)",
replacement: "'always' | 'hover' | 'never'",
version: "3.0.0",
ref: "https://element-plus.org/en-US/component/link.html#underline"
}, computed(() => isBoolean(props.underline)));
const ns = useNamespace("link");
const linkKls = computed(() => [
ns.b(),
ns.m(props.type ?? globalConfig.value?.type ?? "default"),
ns.is("disabled", props.disabled),
ns.is("underline", underline.value === "always"),
ns.is("hover-underline", underline.value === "hover" && !props.disabled)
]);
const underline = computed(() => {
if (isBoolean(props.underline)) return props.underline ? "hover" : "never";
else return props.underline ?? globalConfig.value?.underline ?? "hover";
});
function handleClick(event) {
if (!props.disabled) emit("click", event);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("a", {
class: normalizeClass(linkKls.value),
href: __props.disabled || !__props.href ? void 0 : __props.href,
target: __props.disabled || !__props.href ? void 0 : __props.target,
onClick: handleClick
}, [
__props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
_: 1
})) : createCommentVNode("v-if", true),
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(ns).e("inner"))
}, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true),
_ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
], 10, _hoisted_1);
};
}
});
//#endregion
export { link_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=link.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"link.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../../../../packages/components/link/src/link.vue"],"sourcesContent":["<template>\n <a\n :class=\"linkKls\"\n :href=\"disabled || !href ? undefined : href\"\n :target=\"disabled || !href ? undefined : target\"\n @click=\"handleClick\"\n >\n <el-icon v-if=\"icon\"><component :is=\"icon\" /></el-icon>\n <span v-if=\"$slots.default\" :class=\"ns.e('inner')\">\n <slot />\n </span>\n\n <slot v-if=\"$slots.icon\" name=\"icon\" />\n </a>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useGlobalConfig } from '@element-plus/components/config-provider'\nimport { useDeprecated, useNamespace } from '@element-plus/hooks'\nimport { isBoolean } from '@element-plus/utils'\nimport { linkEmits } from './link'\n\nimport type { LinkProps } from './link'\n\ndefineOptions({\n name: 'ElLink',\n})\nconst props = withDefaults(defineProps<LinkProps>(), {\n type: undefined,\n underline: undefined,\n href: '',\n target: '_self',\n})\nconst emit = defineEmits(linkEmits)\nconst globalConfig = useGlobalConfig('link')\n\nuseDeprecated(\n {\n scope: 'el-link',\n from: 'The underline option (boolean)',\n replacement: \"'always' | 'hover' | 'never'\",\n version: '3.0.0',\n ref: 'https://element-plus.org/en-US/component/link.html#underline',\n },\n computed(() => isBoolean(props.underline))\n)\n\nconst ns = useNamespace('link')\n\nconst linkKls = computed(() => [\n ns.b(),\n ns.m(props.type ?? globalConfig.value?.type ?? 'default'),\n ns.is('disabled', props.disabled),\n ns.is('underline', underline.value === 'always'),\n ns.is('hover-underline', underline.value === 'hover' && !props.disabled),\n])\n\n// Boolean compatibility\nconst underline = computed(() => {\n if (isBoolean(props.underline)) {\n return props.underline ? 'hover' : 'never'\n } else return props.underline ?? globalConfig.value?.underline ?? 'hover'\n})\n\nfunction handleClick(event: MouseEvent) {\n if (!props.disabled) emit('click', event)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EA6BA,MAAM,QAAQ;EAMd,MAAM,OAAO;EACb,MAAM,eAAe,gBAAgB,OAAM;AAE3C,gBACE;GACE,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS;GACT,KAAK;GACN,EACD,eAAe,UAAU,MAAM,UAAU,CAAA,CAC3C;EAEA,MAAM,KAAK,aAAa,OAAM;EAE9B,MAAM,UAAU,eAAe;GAC7B,GAAG,GAAG;GACN,GAAG,EAAE,MAAM,QAAQ,aAAa,OAAO,QAAQ,UAAU;GACzD,GAAG,GAAG,YAAY,MAAM,SAAS;GACjC,GAAG,GAAG,aAAa,UAAU,UAAU,SAAS;GAChD,GAAG,GAAG,mBAAmB,UAAU,UAAU,WAAW,CAAC,MAAM,SAAS;GACzE,CAAA;EAGD,MAAM,YAAY,eAAe;AAC/B,OAAI,UAAU,MAAM,UAAU,CAC5B,QAAO,MAAM,YAAY,UAAU;OAC9B,QAAO,MAAM,aAAa,aAAa,OAAO,aAAa;IACnE;EAED,SAAS,YAAY,OAAmB;AACtC,OAAI,CAAC,MAAM,SAAU,MAAK,SAAS,MAAK;;;uBAlExC,mBAYI,KAAA;IAXD,OAAK,eAAE,QAAA,MAAO;IACd,MAAM,QAAA,YAAQ,CAAK,QAAA,OAAO,SAAY,QAAA;IACtC,QAAQ,QAAA,YAAQ,CAAK,QAAA,OAAO,SAAY,QAAA;IACxC,SAAO;;IAEO,QAAA,qBAAf,YAAuD,MAAA,OAAA,EAAA,EAAA,KAAA,GAAA,EAAA;4BAAV,eAAxB,YAAwB,wBAAR,QAAA,KAAI,CAAA;;;IAC7BA,KAAAA,OAAO,wBAAnB,mBAEO,QAAA;;KAFsB,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,QAAA,CAAA;QACtC,WAAQ,KAAA,QAAA,UAAA;IAGEA,KAAAA,OAAO,OAAnB,WAAuC,KAAA,QAAA,QAAA,EAAA,KAAA,GAAA,CAAA"}
+8
View File
@@ -0,0 +1,8 @@
import link_vue_vue_type_script_setup_true_lang_default from "./link.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/link/src/link.vue
var link_default = link_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { link_default as default };
//# sourceMappingURL=link2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"link2.mjs","names":[],"sources":["../../../../../../packages/components/link/src/link.vue"],"sourcesContent":["<template>\n <a\n :class=\"linkKls\"\n :href=\"disabled || !href ? undefined : href\"\n :target=\"disabled || !href ? undefined : target\"\n @click=\"handleClick\"\n >\n <el-icon v-if=\"icon\"><component :is=\"icon\" /></el-icon>\n <span v-if=\"$slots.default\" :class=\"ns.e('inner')\">\n <slot />\n </span>\n\n <slot v-if=\"$slots.icon\" name=\"icon\" />\n </a>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useGlobalConfig } from '@element-plus/components/config-provider'\nimport { useDeprecated, useNamespace } from '@element-plus/hooks'\nimport { isBoolean } from '@element-plus/utils'\nimport { linkEmits } from './link'\n\nimport type { LinkProps } from './link'\n\ndefineOptions({\n name: 'ElLink',\n})\nconst props = withDefaults(defineProps<LinkProps>(), {\n type: undefined,\n underline: undefined,\n href: '',\n target: '_self',\n})\nconst emit = defineEmits(linkEmits)\nconst globalConfig = useGlobalConfig('link')\n\nuseDeprecated(\n {\n scope: 'el-link',\n from: 'The underline option (boolean)',\n replacement: \"'always' | 'hover' | 'never'\",\n version: '3.0.0',\n ref: 'https://element-plus.org/en-US/component/link.html#underline',\n },\n computed(() => isBoolean(props.underline))\n)\n\nconst ns = useNamespace('link')\n\nconst linkKls = computed(() => [\n ns.b(),\n ns.m(props.type ?? globalConfig.value?.type ?? 'default'),\n ns.is('disabled', props.disabled),\n ns.is('underline', underline.value === 'always'),\n ns.is('hover-underline', underline.value === 'hover' && !props.disabled),\n])\n\n// Boolean compatibility\nconst underline = computed(() => {\n if (isBoolean(props.underline)) {\n return props.underline ? 'hover' : 'never'\n } else return props.underline ?? globalConfig.value?.underline ?? 'hover'\n})\n\nfunction handleClick(event: MouseEvent) {\n if (!props.disabled) emit('click', event)\n}\n</script>\n"],"mappings":""}
+2
View File
@@ -0,0 +1,2 @@
import "../../base/style/css.mjs";
import "element-plus/theme-chalk/el-link.css";
@@ -0,0 +1,2 @@
import "../../base/style/index.mjs";
import "element-plus/theme-chalk/src/link.scss";