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 { TextProps, TextPropsPublic, textProps } from "./src/text.js";
import { _default } from "./src/text.vue.js";
//#region ../../packages/components/text/index.d.ts
declare const ElText: SFCWithInstall<typeof _default>;
//#endregion
export { ElText, ElText as default, TextProps, TextPropsPublic, textProps };
+10
View File
@@ -0,0 +1,10 @@
import { withInstall } from "../../utils/vue/install.mjs";
import { textProps } from "./src/text.mjs";
import text_default from "./src/text2.mjs";
//#region ../../packages/components/text/index.ts
const ElText = withInstall(text_default);
//#endregion
export { ElText, ElText as default, textProps };
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["Text"],"sources":["../../../../../packages/components/text/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Text from './src/text.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElText: SFCWithInstall<typeof Text> = withInstall(Text)\nexport default ElText\n\nexport * from './src/text'\n"],"mappings":";;;;;AAKA,MAAa,SAAsC,YAAYA,aAAK"}
+50
View File
@@ -0,0 +1,50 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import { ComponentSize } from "../../../constants/size.js";
import "../../../utils/index.js";
import * as vue from "vue";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/text/src/text.d.ts
interface TextProps {
/**
* @description text type
*/
type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | '';
/**
* @description text size
*/
size?: ComponentSize;
/**
* @description render ellipsis
*/
truncated?: boolean;
/**
* @description maximum lines
*/
lineClamp?: number | string;
/**
* @description custom element tag
*/
tag?: string;
}
/**
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
*/
declare const textProps: {
readonly type: EpPropFinalized<StringConstructor, "" | "info" | "primary" | "success" | "warning" | "danger", unknown, "", boolean>;
readonly size: EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
readonly truncated: BooleanConstructor;
readonly lineClamp: {
readonly type: vue.PropType<EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "span", boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
*/
type TextPropsPublic = ExtractPublicPropTypes<typeof textProps>;
//#endregion
export { TextProps, TextPropsPublic, textProps };
+36
View File
@@ -0,0 +1,36 @@
import { componentSizes } from "../../../constants/size.mjs";
import { buildProps } from "../../../utils/vue/props/runtime.mjs";
//#region ../../packages/components/text/src/text.ts
/**
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
*/
const textProps = buildProps({
type: {
type: String,
values: [
"primary",
"success",
"info",
"warning",
"danger",
""
],
default: ""
},
size: {
type: String,
values: componentSizes,
default: ""
},
truncated: Boolean,
lineClamp: { type: [String, Number] },
tag: {
type: String,
default: "span"
}
});
//#endregion
export { textProps };
//# sourceMappingURL=text.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"text.mjs","names":[],"sources":["../../../../../../packages/components/text/src/text.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\n\nexport interface TextProps {\n /**\n * @description text type\n */\n type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | ''\n /**\n * @description text size\n */\n size?: ComponentSize\n /**\n * @description render ellipsis\n */\n truncated?: boolean\n /**\n * @description maximum lines\n */\n lineClamp?: number | string\n /**\n * @description custom element tag\n */\n tag?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `TextProps` instead.\n */\nexport const textProps = buildProps({\n /**\n * @description text type\n */\n type: {\n type: String,\n values: ['primary', 'success', 'info', 'warning', 'danger', ''],\n default: '',\n },\n /**\n * @description text size\n */\n size: {\n type: String,\n values: componentSizes,\n default: '',\n },\n /**\n * @description render ellipsis\n */\n truncated: Boolean,\n /**\n * @description maximum lines\n */\n lineClamp: {\n type: [String, Number],\n },\n /**\n * @description custom element tag\n */\n tag: {\n type: String,\n default: 'span',\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `TextProps` instead.\n */\nexport type TextPropsPublic = ExtractPublicPropTypes<typeof textProps>\n"],"mappings":";;;;;;;AAgCA,MAAa,YAAY,WAAW;CAIlC,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAW;GAAW;GAAQ;GAAW;GAAU;GAAG;EAC/D,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ;EACR,SAAS;EACV;CAID,WAAW;CAIX,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,KAAK;EACH,MAAM;EACN,SAAS;EACV;CACF,CAAU"}
@@ -0,0 +1,24 @@
import { ComponentSize } from "../../../constants/size.js";
import { TextProps } from "./text.js";
import "../../../index.js";
import * as vue from "vue";
//#region ../../packages/components/text/src/text.vue.d.ts
declare var __VLS_9: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_9) => any;
};
declare const __VLS_base: vue.DefineComponent<TextProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<TextProps> & Readonly<{}>, {
type: "primary" | "success" | "info" | "warning" | "danger" | "";
size: ComponentSize;
tag: 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,58 @@
import { isUndefined } from "../../../utils/types.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { useFormSize } from "../../form/src/hooks/use-form-common-props.mjs";
import { textProps } from "./text.mjs";
import { computed, createBlock, defineComponent, normalizeClass, normalizeStyle, onMounted, onUpdated, openBlock, ref, renderSlot, resolveDynamicComponent, useAttrs, withCtx } from "vue";
//#region ../../packages/components/text/src/text.vue?vue&type=script&setup=true&lang.ts
var text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElText",
__name: "text",
props: textProps,
setup(__props) {
const props = __props;
const textRef = ref();
const textSize = useFormSize();
const ns = useNamespace("text");
const textKls = computed(() => [
ns.b(),
ns.m(props.type),
ns.m(textSize.value),
ns.is("truncated", props.truncated),
ns.is("line-clamp", !isUndefined(props.lineClamp))
]);
const bindTitle = () => {
if (useAttrs().title) return;
let shouldAddTitle = false;
const text = textRef.value?.textContent || "";
if (props.truncated) {
const width = textRef.value?.offsetWidth;
const scrollWidth = textRef.value?.scrollWidth;
if (width && scrollWidth && scrollWidth > width) shouldAddTitle = true;
} else if (!isUndefined(props.lineClamp)) {
const height = textRef.value?.offsetHeight;
const scrollHeight = textRef.value?.scrollHeight;
if (height && scrollHeight && scrollHeight > height) shouldAddTitle = true;
}
if (shouldAddTitle) textRef.value?.setAttribute("title", text);
else textRef.value?.removeAttribute("title");
};
onMounted(bindTitle);
onUpdated(bindTitle);
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
ref_key: "textRef",
ref: textRef,
class: normalizeClass(textKls.value),
style: normalizeStyle({ "-webkit-line-clamp": __props.lineClamp })
}, {
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
_: 3
}, 8, ["class", "style"]);
};
}
});
//#endregion
export { text_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=text.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"text.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../../../packages/components/text/src/text.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n ref=\"textRef\"\n :class=\"textKls\"\n :style=\"{ '-webkit-line-clamp': lineClamp }\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, onUpdated, ref, useAttrs } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isUndefined } from '@element-plus/utils'\n\nimport type { TextProps } from './text'\n\ndefineOptions({\n name: 'ElText',\n})\n\nconst props = withDefaults(defineProps<TextProps>(), {\n type: '',\n size: '',\n tag: 'span',\n})\nconst textRef = ref<HTMLElement>()\n\nconst textSize = useFormSize()\nconst ns = useNamespace('text')\n\nconst textKls = computed(() => [\n ns.b(),\n ns.m(props.type),\n ns.m(textSize.value),\n ns.is('truncated', props.truncated),\n ns.is('line-clamp', !isUndefined(props.lineClamp)),\n])\n\nconst bindTitle = () => {\n const inheritTitle = useAttrs().title\n\n if (inheritTitle) return\n let shouldAddTitle = false\n const text = textRef.value?.textContent || ''\n\n if (props.truncated) {\n const width = textRef.value?.offsetWidth\n const scrollWidth = textRef.value?.scrollWidth\n if (width && scrollWidth && scrollWidth > width) {\n shouldAddTitle = true\n }\n } else if (!isUndefined(props.lineClamp)) {\n const height = textRef.value?.offsetHeight\n const scrollHeight = textRef.value?.scrollHeight\n if (height && scrollHeight && scrollHeight > height) {\n shouldAddTitle = true\n }\n }\n\n if (shouldAddTitle) {\n textRef.value?.setAttribute('title', text)\n } else {\n textRef.value?.removeAttribute('title')\n }\n}\n\nonMounted(bindTitle)\nonUpdated(bindTitle)\n</script>\n"],"mappings":";;;;;;;;;;;;EAuBA,MAAM,QAAQ;EAKd,MAAM,UAAU,KAAiB;EAEjC,MAAM,WAAW,aAAY;EAC7B,MAAM,KAAK,aAAa,OAAM;EAE9B,MAAM,UAAU,eAAe;GAC7B,GAAG,GAAG;GACN,GAAG,EAAE,MAAM,KAAK;GAChB,GAAG,EAAE,SAAS,MAAM;GACpB,GAAG,GAAG,aAAa,MAAM,UAAU;GACnC,GAAG,GAAG,cAAc,CAAC,YAAY,MAAM,UAAU,CAAC;GACnD,CAAA;EAED,MAAM,kBAAkB;AAGtB,OAFqB,UAAU,CAAC,MAEd;GAClB,IAAI,iBAAiB;GACrB,MAAM,OAAO,QAAQ,OAAO,eAAe;AAE3C,OAAI,MAAM,WAAW;IACnB,MAAM,QAAQ,QAAQ,OAAO;IAC7B,MAAM,cAAc,QAAQ,OAAO;AACnC,QAAI,SAAS,eAAe,cAAc,MACxC,kBAAiB;cAEV,CAAC,YAAY,MAAM,UAAU,EAAE;IACxC,MAAM,SAAS,QAAQ,OAAO;IAC9B,MAAM,eAAe,QAAQ,OAAO;AACpC,QAAI,UAAU,gBAAgB,eAAe,OAC3C,kBAAiB;;AAIrB,OAAI,eACF,SAAQ,OAAO,aAAa,SAAS,KAAI;OAEzC,SAAQ,OAAO,gBAAgB,QAAO;;AAI1C,YAAU,UAAS;AACnB,YAAU,UAAS;;uBArEjB,YAOY,wBANL,QAAA,IAAG,EAAA;aACJ;IAAJ,KAAI;IACH,OAAK,eAAE,QAAA,MAAO;IACd,OAAK,eAAA,EAAA,sBAA0B,QAAA,WAAS,CAAA;;2BAEjC,CAAR,WAAQ,KAAA,QAAA,UAAA"}
+8
View File
@@ -0,0 +1,8 @@
import text_vue_vue_type_script_setup_true_lang_default from "./text.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/text/src/text.vue
var text_default = text_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { text_default as default };
//# sourceMappingURL=text2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"text2.mjs","names":[],"sources":["../../../../../../packages/components/text/src/text.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n ref=\"textRef\"\n :class=\"textKls\"\n :style=\"{ '-webkit-line-clamp': lineClamp }\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, onUpdated, ref, useAttrs } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isUndefined } from '@element-plus/utils'\n\nimport type { TextProps } from './text'\n\ndefineOptions({\n name: 'ElText',\n})\n\nconst props = withDefaults(defineProps<TextProps>(), {\n type: '',\n size: '',\n tag: 'span',\n})\nconst textRef = ref<HTMLElement>()\n\nconst textSize = useFormSize()\nconst ns = useNamespace('text')\n\nconst textKls = computed(() => [\n ns.b(),\n ns.m(props.type),\n ns.m(textSize.value),\n ns.is('truncated', props.truncated),\n ns.is('line-clamp', !isUndefined(props.lineClamp)),\n])\n\nconst bindTitle = () => {\n const inheritTitle = useAttrs().title\n\n if (inheritTitle) return\n let shouldAddTitle = false\n const text = textRef.value?.textContent || ''\n\n if (props.truncated) {\n const width = textRef.value?.offsetWidth\n const scrollWidth = textRef.value?.scrollWidth\n if (width && scrollWidth && scrollWidth > width) {\n shouldAddTitle = true\n }\n } else if (!isUndefined(props.lineClamp)) {\n const height = textRef.value?.offsetHeight\n const scrollHeight = textRef.value?.scrollHeight\n if (height && scrollHeight && scrollHeight > height) {\n shouldAddTitle = true\n }\n }\n\n if (shouldAddTitle) {\n textRef.value?.setAttribute('title', text)\n } else {\n textRef.value?.removeAttribute('title')\n }\n}\n\nonMounted(bindTitle)\nonUpdated(bindTitle)\n</script>\n"],"mappings":""}
+2
View File
@@ -0,0 +1,2 @@
import "../../base/style/css.mjs";
import "element-plus/theme-chalk/el-text.css";
@@ -0,0 +1,2 @@
import "../../base/style/index.mjs";
import "element-plus/theme-chalk/src/text.scss";