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
+10
View File
@@ -0,0 +1,10 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import "../../utils/index.js";
import { CardConfigContext, CardProps, CardPropsPublic, cardContextKey, cardProps } from "./src/card.js";
import { _default } from "./src/card.vue.js";
import { CardInstance } from "./src/instance.js";
//#region ../../packages/components/card/index.d.ts
declare const ElCard: SFCWithInstall<typeof _default>;
//#endregion
export { CardConfigContext, type CardInstance, CardProps, CardPropsPublic, ElCard, ElCard as default, cardContextKey, cardProps };
+10
View File
@@ -0,0 +1,10 @@
import { withInstall } from "../../utils/vue/install.mjs";
import { cardContextKey, cardProps } from "./src/card.mjs";
import card_default from "./src/card2.mjs";
//#region ../../packages/components/card/index.ts
const ElCard = withInstall(card_default);
//#endregion
export { ElCard, ElCard as default, cardContextKey, cardProps };
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["Card"],"sources":["../../../../../packages/components/card/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Card from './src/card.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElCard: SFCWithInstall<typeof Card> = withInstall(Card)\nexport default ElCard\n\nexport * from './src/card'\nexport type { CardInstance } from './src/instance'\n"],"mappings":";;;;;AAKA,MAAa,SAAsC,YAAYA,aAAK"}
+58
View File
@@ -0,0 +1,58 @@
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import * as vue from "vue";
import { ExtractPublicPropTypes, InjectionKey, StyleValue } from "vue";
//#region ../../packages/components/card/src/card.d.ts
interface CardProps {
/**
* @description title of the card. Also accepts a DOM passed by `slot#header`
*/
header?: string;
/**
* @description content of footer. Also accepts a DOM passed by `slot#footer`
*/
footer?: string;
/**
* @description CSS style of card body
*/
bodyStyle?: StyleValue;
/**
* @description custom class name of card header
*/
headerClass?: string;
/**
* @description custom class name of card body
*/
bodyClass?: string;
/**
* @description custom class name of card footer
*/
footerClass?: string;
/**
* @description when to show card shadows
*/
shadow?: 'always' | 'hover' | 'never';
}
/**
* @deprecated Removed after 3.0.0, Use `CardProps` instead.
*/
declare const cardProps: {
readonly header: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly footer: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly bodyStyle: EpPropFinalized<(new (...args: any[]) => string | false | vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, "", boolean>;
readonly headerClass: StringConstructor;
readonly bodyClass: StringConstructor;
readonly footerClass: StringConstructor;
readonly shadow: EpPropFinalized<StringConstructor, "always" | "never" | "hover", unknown, undefined, boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `CardProps` instead.
*/
type CardPropsPublic = ExtractPublicPropTypes<typeof cardProps>;
interface CardConfigContext {
shadow?: CardProps['shadow'];
}
declare const cardContextKey: InjectionKey<CardConfigContext>;
//#endregion
export { CardConfigContext, CardProps, CardPropsPublic, cardContextKey, cardProps };
+41
View File
@@ -0,0 +1,41 @@
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
//#region ../../packages/components/card/src/card.ts
/**
* @deprecated Removed after 3.0.0, Use `CardProps` instead.
*/
const cardProps = buildProps({
header: {
type: String,
default: ""
},
footer: {
type: String,
default: ""
},
bodyStyle: {
type: definePropType([
String,
Object,
Array
]),
default: ""
},
headerClass: String,
bodyClass: String,
footerClass: String,
shadow: {
type: String,
values: [
"always",
"hover",
"never"
],
default: void 0
}
});
const cardContextKey = Symbol("cardContextKey");
//#endregion
export { cardContextKey, cardProps };
//# sourceMappingURL=card.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"card.mjs","names":[],"sources":["../../../../../../packages/components/card/src/card.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes, InjectionKey, StyleValue } from 'vue'\n\nexport interface CardProps {\n /**\n * @description title of the card. Also accepts a DOM passed by `slot#header`\n */\n header?: string\n /**\n * @description content of footer. Also accepts a DOM passed by `slot#footer`\n */\n footer?: string\n /**\n * @description CSS style of card body\n */\n bodyStyle?: StyleValue\n /**\n * @description custom class name of card header\n */\n headerClass?: string\n /**\n * @description custom class name of card body\n */\n bodyClass?: string\n /**\n * @description custom class name of card footer\n */\n footerClass?: string\n /**\n * @description when to show card shadows\n */\n shadow?: 'always' | 'hover' | 'never'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CardProps` instead.\n */\nexport const cardProps = buildProps({\n /**\n * @description title of the card. Also accepts a DOM passed by `slot#header`\n */\n header: {\n type: String,\n default: '',\n },\n /**\n * @description content of footer. Also accepts a DOM passed by `slot#footer`\n */\n footer: {\n type: String,\n default: '',\n },\n /**\n * @description CSS style of card body\n */\n bodyStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n /**\n * @description custom class name of card footer\n */\n headerClass: String,\n /**\n * @description custom class name of card body\n */\n bodyClass: String,\n /**\n * @description custom class name of card footer\n */\n footerClass: String,\n /**\n * @description when to show card shadows\n */\n shadow: {\n type: String,\n values: ['always', 'hover', 'never'],\n default: undefined,\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `CardProps` instead.\n */\nexport type CardPropsPublic = ExtractPublicPropTypes<typeof cardProps>\nexport interface CardConfigContext {\n shadow?: CardProps['shadow']\n}\n\nexport const cardContextKey: InjectionKey<CardConfigContext> =\n Symbol('cardContextKey')\n"],"mappings":";;;;;;AAsCA,MAAa,YAAY,WAAW;CAIlC,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM,eAA2B;GAAC;GAAQ;GAAQ;GAAM,CAAC;EACzD,SAAS;EACV;CAID,aAAa;CAIb,WAAW;CAIX,aAAa;CAIb,QAAQ;EACN,MAAM;EACN,QAAQ;GAAC;GAAU;GAAS;GAAQ;EACpC,SAAS;EACV;CACF,CAAU;AAUX,MAAa,iBACX,OAAO,iBAAiB"}
@@ -0,0 +1,27 @@
import { CardProps } from "./card.js";
import * as vue from "vue";
//#region ../../packages/components/card/src/card.vue.d.ts
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
type __VLS_Slots = {} & {
header?: (props: typeof __VLS_1) => any;
} & {
default?: (props: typeof __VLS_3) => any;
} & {
footer?: (props: typeof __VLS_5) => any;
};
declare const __VLS_base: vue.DefineComponent<CardProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<CardProps> & Readonly<{}>, {
header: string;
footer: string;
bodyStyle: string | false | vue.CSSProperties | vue.StyleValue[] | null;
shadow: "always" | "hover" | "never";
}, {}, {}, {}, 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,35 @@
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { useGlobalConfig } from "../../config-provider/src/hooks/use-global-config.mjs";
import { cardProps } from "./card.mjs";
import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, toDisplayString, unref } from "vue";
//#region ../../packages/components/card/src/card.vue?vue&type=script&setup=true&lang.ts
var card_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElCard",
__name: "card",
props: cardProps,
setup(__props) {
const globalConfig = useGlobalConfig("card");
const ns = useNamespace("card");
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b(), unref(ns).is(`${__props.shadow || unref(globalConfig)?.shadow || "always"}-shadow`)]) }, [
_ctx.$slots.header || __props.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("header"), __props.headerClass])
}, [renderSlot(_ctx.$slots, "header", {}, () => [createTextVNode(toDisplayString(__props.header), 1)])], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass([unref(ns).e("body"), __props.bodyClass]),
style: normalizeStyle(__props.bodyStyle)
}, [renderSlot(_ctx.$slots, "default")], 6),
_ctx.$slots.footer || __props.footer ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
}, [renderSlot(_ctx.$slots, "footer", {}, () => [createTextVNode(toDisplayString(__props.footer), 1)])], 2)) : createCommentVNode("v-if", true)
], 2);
};
}
});
//#endregion
export { card_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=card.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"card.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../../../../packages/components/card/src/card.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.is(`${shadow || globalConfig?.shadow || 'always'}-shadow`),\n ]\"\n >\n <div v-if=\"$slots.header || header\" :class=\"[ns.e('header'), headerClass]\">\n <slot name=\"header\">{{ header }}</slot>\n </div>\n <div :class=\"[ns.e('body'), bodyClass]\" :style=\"bodyStyle\">\n <slot />\n </div>\n <div v-if=\"$slots.footer || footer\" :class=\"[ns.e('footer'), footerClass]\">\n <slot name=\"footer\">{{ footer }}</slot>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport { useGlobalConfig } from '@element-plus/components/config-provider'\n\nimport type { CardProps } from './card'\n\nconst globalConfig = useGlobalConfig('card')\n\ndefineOptions({\n name: 'ElCard',\n})\n\nwithDefaults(defineProps<CardProps>(), {\n header: '',\n footer: '',\n bodyStyle: '',\n shadow: undefined,\n})\n\nconst ns = useNamespace('card')\n</script>\n"],"mappings":";;;;;;;;;;;EAyBA,MAAM,eAAe,gBAAgB,OAAM;EAa3C,MAAM,KAAK,aAAa,OAAM;;uBArC5B,mBAeM,OAAA,EAdH,OAAK,eAAA,CAAU,MAAA,GAAE,CAAC,GAAC,EAAU,MAAA,GAAE,CAAC,GAAE,GAAI,QAAA,UAAU,MAAA,aAAY,EAAE,UAAM,SAAA,SAAA;IAK1DA,KAAAA,OAAO,UAAU,QAAA,uBAA5B,mBAEM,OAAA;;KAF+B,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,SAAA,EAAY,QAAA,YAAW,CAAA;QACtE,WAAuC,KAAA,QAAA,UAAA,EAAA,QAAA,iCAAhB,QAAA,OAAM,EAAA,EAAA;IAE/B,mBAEM,OAAA;KAFA,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,OAAA,EAAU,QAAA,UAAS,CAAA;KAAI,OAAK,eAAE,QAAA,UAAS;QACvD,WAAQ,KAAA,QAAA,UAAA;IAECA,KAAAA,OAAO,UAAU,QAAA,uBAA5B,mBAEM,OAAA;;KAF+B,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,SAAA,EAAY,QAAA,YAAW,CAAA;QACtE,WAAuC,KAAA,QAAA,UAAA,EAAA,QAAA,iCAAhB,QAAA,OAAM,EAAA,EAAA"}
+8
View File
@@ -0,0 +1,8 @@
import card_vue_vue_type_script_setup_true_lang_default from "./card.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/card/src/card.vue
var card_default = card_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { card_default as default };
//# sourceMappingURL=card2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"card2.mjs","names":[],"sources":["../../../../../../packages/components/card/src/card.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.is(`${shadow || globalConfig?.shadow || 'always'}-shadow`),\n ]\"\n >\n <div v-if=\"$slots.header || header\" :class=\"[ns.e('header'), headerClass]\">\n <slot name=\"header\">{{ header }}</slot>\n </div>\n <div :class=\"[ns.e('body'), bodyClass]\" :style=\"bodyStyle\">\n <slot />\n </div>\n <div v-if=\"$slots.footer || footer\" :class=\"[ns.e('footer'), footerClass]\">\n <slot name=\"footer\">{{ footer }}</slot>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport { useGlobalConfig } from '@element-plus/components/config-provider'\n\nimport type { CardProps } from './card'\n\nconst globalConfig = useGlobalConfig('card')\n\ndefineOptions({\n name: 'ElCard',\n})\n\nwithDefaults(defineProps<CardProps>(), {\n header: '',\n footer: '',\n bodyStyle: '',\n shadow: undefined,\n})\n\nconst ns = useNamespace('card')\n</script>\n"],"mappings":""}
@@ -0,0 +1,6 @@
import { _default } from "./card.vue.js";
//#region ../../packages/components/card/src/instance.d.ts
type CardInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { CardInstance };
+2
View File
@@ -0,0 +1,2 @@
import "../../base/style/css.mjs";
import "element-plus/theme-chalk/el-card.css";
@@ -0,0 +1,2 @@
import "../../base/style/index.mjs";
import "element-plus/theme-chalk/src/card.scss";