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 { ColInstance, ColProps, ColPropsPublic, ColSize, ColSizeObject, colProps } from "./src/col.js";
import { _default } from "./src/col.vue.js";
//#region ../../packages/components/col/index.d.ts
declare const ElCol: SFCWithInstall<typeof _default>;
//#endregion
export { ColInstance, ColProps, ColPropsPublic, ColSize, ColSizeObject, ElCol, ElCol as default, colProps };
+10
View File
@@ -0,0 +1,10 @@
import { withInstall } from "../../utils/vue/install.mjs";
import { colProps } from "./src/col.mjs";
import col_default from "./src/col2.mjs";
//#region ../../packages/components/col/index.ts
const ElCol = withInstall(col_default);
//#endregion
export { ElCol, ElCol as default, colProps };
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["Col"],"sources":["../../../../../packages/components/col/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Col from './src/col.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElCol: SFCWithInstall<typeof Col> = withInstall(Col)\nexport default ElCol\n\nexport * from './src/col'\n"],"mappings":";;;;;AAKA,MAAa,QAAoC,YAAYA,YAAI"}
+78
View File
@@ -0,0 +1,78 @@
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
import { Mutable } from "../../../utils/typescript.js";
import "../../../utils/index.js";
import { _default } from "./col.vue.js";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/col/src/col.d.ts
type ColSizeObject = {
span?: number;
offset?: number;
pull?: number;
push?: number;
};
type ColSize = number | ColSizeObject;
interface ColProps {
/**
* @description custom element tag
*/
tag?: string;
/**
* @description number of column the grid spans
*/
span?: number;
/**
* @description number of spacing on the left side of the grid
*/
offset?: number;
/**
* @description number of columns that grid moves to the left
*/
pull?: number;
/**
* @description number of columns that grid moves to the right
*/
push?: number;
/**
* @description `<768px` Responsive columns or column props object
*/
xs?: ColSize;
/**
* @description `≥768px` Responsive columns or column props object
*/
sm?: ColSize;
/**
* @description `≥992px` Responsive columns or column props object
*/
md?: ColSize;
/**
* @description `≥1200px` Responsive columns or column props object
*/
lg?: ColSize;
/**
* @description `≥1920px` Responsive columns or column props object
*/
xl?: ColSize;
}
/**
* @deprecated Removed after 3.0.0, Use `ColProps` instead.
*/
declare const colProps: {
readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
readonly span: EpPropFinalized<NumberConstructor, unknown, unknown, 24, boolean>;
readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly pull: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly push: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly xs: EpPropFinalized<(new (...args: any[]) => number | ColSizeObject) | (() => ColSize) | (((new (...args: any[]) => number | ColSizeObject) | (() => ColSize)) | null)[], unknown, unknown, () => Mutable<{}>, boolean>;
readonly sm: EpPropFinalized<(new (...args: any[]) => number | ColSizeObject) | (() => ColSize) | (((new (...args: any[]) => number | ColSizeObject) | (() => ColSize)) | null)[], unknown, unknown, () => Mutable<{}>, boolean>;
readonly md: EpPropFinalized<(new (...args: any[]) => number | ColSizeObject) | (() => ColSize) | (((new (...args: any[]) => number | ColSizeObject) | (() => ColSize)) | null)[], unknown, unknown, () => Mutable<{}>, boolean>;
readonly lg: EpPropFinalized<(new (...args: any[]) => number | ColSizeObject) | (() => ColSize) | (((new (...args: any[]) => number | ColSizeObject) | (() => ColSize)) | null)[], unknown, unknown, () => Mutable<{}>, boolean>;
readonly xl: EpPropFinalized<(new (...args: any[]) => number | ColSizeObject) | (() => ColSize) | (((new (...args: any[]) => number | ColSizeObject) | (() => ColSize)) | null)[], unknown, unknown, () => Mutable<{}>, boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `ColProps` instead.
*/
type ColPropsPublic = ExtractPublicPropTypes<typeof colProps>;
type ColInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { ColInstance, ColProps, ColPropsPublic, ColSize, ColSizeObject, colProps };
+53
View File
@@ -0,0 +1,53 @@
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
import { mutable } from "../../../utils/typescript.mjs";
//#region ../../packages/components/col/src/col.ts
/**
* @deprecated Removed after 3.0.0, Use `ColProps` instead.
*/
const colProps = buildProps({
tag: {
type: String,
default: "div"
},
span: {
type: Number,
default: 24
},
offset: {
type: Number,
default: 0
},
pull: {
type: Number,
default: 0
},
push: {
type: Number,
default: 0
},
xs: {
type: definePropType([Number, Object]),
default: () => mutable({})
},
sm: {
type: definePropType([Number, Object]),
default: () => mutable({})
},
md: {
type: definePropType([Number, Object]),
default: () => mutable({})
},
lg: {
type: definePropType([Number, Object]),
default: () => mutable({})
},
xl: {
type: definePropType([Number, Object]),
default: () => mutable({})
}
});
//#endregion
export { colProps };
//# sourceMappingURL=col.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"col.mjs","names":[],"sources":["../../../../../../packages/components/col/src/col.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type Col from './col.vue'\n\nexport type ColSizeObject = {\n span?: number\n offset?: number\n pull?: number\n push?: number\n}\nexport type ColSize = number | ColSizeObject\n\nexport interface ColProps {\n /**\n * @description custom element tag\n */\n tag?: string\n /**\n * @description number of column the grid spans\n */\n span?: number\n /**\n * @description number of spacing on the left side of the grid\n */\n offset?: number\n /**\n * @description number of columns that grid moves to the left\n */\n pull?: number\n /**\n * @description number of columns that grid moves to the right\n */\n push?: number\n /**\n * @description `<768px` Responsive columns or column props object\n */\n xs?: ColSize\n /**\n * @description `≥768px` Responsive columns or column props object\n */\n sm?: ColSize\n /**\n * @description `≥992px` Responsive columns or column props object\n */\n md?: ColSize\n /**\n * @description `≥1200px` Responsive columns or column props object\n */\n lg?: ColSize\n /**\n * @description `≥1920px` Responsive columns or column props object\n */\n xl?: ColSize\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColProps` instead.\n */\nexport const colProps = buildProps({\n /**\n * @description custom element tag\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description number of column the grid spans\n */\n span: {\n type: Number,\n default: 24,\n },\n /**\n * @description number of spacing on the left side of the grid\n */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description number of columns that grid moves to the left\n */\n pull: {\n type: Number,\n default: 0,\n },\n /**\n * @description number of columns that grid moves to the right\n */\n push: {\n type: Number,\n default: 0,\n },\n /**\n * @description `<768px` Responsive columns or column props object\n */\n xs: {\n type: definePropType<ColSize>([Number, Object]),\n default: () => mutable({} as const),\n },\n /**\n * @description `≥768px` Responsive columns or column props object\n */\n sm: {\n type: definePropType<ColSize>([Number, Object]),\n default: () => mutable({} as const),\n },\n /**\n * @description `≥992px` Responsive columns or column props object\n */\n md: {\n type: definePropType<ColSize>([Number, Object]),\n default: () => mutable({} as const),\n },\n /**\n * @description `≥1200px` Responsive columns or column props object\n */\n lg: {\n type: definePropType<ColSize>([Number, Object]),\n default: () => mutable({} as const),\n },\n /**\n * @description `≥1920px` Responsive columns or column props object\n */\n xl: {\n type: definePropType<ColSize>([Number, Object]),\n default: () => mutable({} as const),\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColProps` instead.\n */\nexport type ColPropsPublic = ExtractPublicPropTypes<typeof colProps>\nexport type ColInstance = InstanceType<typeof Col> & unknown\n"],"mappings":";;;;;;;AA2DA,MAAa,WAAW,WAAW;CAIjC,KAAK;EACH,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,IAAI;EACF,MAAM,eAAwB,CAAC,QAAQ,OAAO,CAAC;EAC/C,eAAe,QAAQ,EAAE,CAAU;EACpC;CAID,IAAI;EACF,MAAM,eAAwB,CAAC,QAAQ,OAAO,CAAC;EAC/C,eAAe,QAAQ,EAAE,CAAU;EACpC;CAID,IAAI;EACF,MAAM,eAAwB,CAAC,QAAQ,OAAO,CAAC;EAC/C,eAAe,QAAQ,EAAE,CAAU;EACpC;CAID,IAAI;EACF,MAAM,eAAwB,CAAC,QAAQ,OAAO,CAAC;EAC/C,eAAe,QAAQ,EAAE,CAAU;EACpC;CAID,IAAI;EACF,MAAM,eAAwB,CAAC,QAAQ,OAAO,CAAC;EAC/C,eAAe,QAAQ,EAAE,CAAU;EACpC;CACF,CAAU"}
+29
View File
@@ -0,0 +1,29 @@
import { ColProps, ColSize } from "./col.js";
import * as vue from "vue";
//#region ../../packages/components/col/src/col.vue.d.ts
declare var __VLS_8: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_8) => any;
};
declare const __VLS_base: vue.DefineComponent<ColProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ColProps> & Readonly<{}>, {
offset: number;
push: number;
tag: string;
span: number;
pull: number;
xs: ColSize;
sm: ColSize;
md: ColSize;
lg: ColSize;
xl: ColSize;
}, {}, {}, {}, 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,64 @@
import { isNumber, isObject } from "../../../utils/types.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { colProps } from "./col.mjs";
import { rowContextKey } from "../../row/src/constants.mjs";
import { computed, createBlock, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, withCtx } from "vue";
//#region ../../packages/components/col/src/col.vue?vue&type=script&setup=true&lang.ts
var col_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElCol",
__name: "col",
props: colProps,
setup(__props) {
const props = __props;
const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
const ns = useNamespace("col");
const style = computed(() => {
const styles = {};
if (gutter.value) styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
return styles;
});
const colKls = computed(() => {
const classes = [];
[
"span",
"offset",
"pull",
"push"
].forEach((prop) => {
const size = props[prop];
if (isNumber(size)) {
if (prop === "span") classes.push(ns.b(`${props[prop]}`));
else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`));
}
});
[
"xs",
"sm",
"md",
"lg",
"xl"
].forEach((size) => {
if (isNumber(props[size])) classes.push(ns.b(`${size}-${props[size]}`));
else if (isObject(props[size])) Object.entries(props[size]).forEach(([prop, sizeProp]) => {
classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
});
});
if (gutter.value) classes.push(ns.is("guttered"));
return [ns.b(), classes];
});
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
class: normalizeClass(colKls.value),
style: normalizeStyle(style.value)
}, {
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
_: 3
}, 8, ["class", "style"]);
};
}
});
//#endregion
export { col_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=col.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"col.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../../../packages/components/col/src/col.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"colKls\" :style=\"style\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rowContextKey } from '@element-plus/components/row'\n\nimport type { CSSProperties } from 'vue'\nimport type { ColProps } from './col'\n\ndefineOptions({\n name: 'ElCol',\n})\n\nconst props = withDefaults(defineProps<ColProps>(), {\n tag: 'div',\n span: 24,\n offset: 0,\n pull: 0,\n push: 0,\n xs: () => ({}),\n sm: () => ({}),\n md: () => ({}),\n lg: () => ({}),\n xl: () => ({}),\n})\n\nconst { gutter } = inject(rowContextKey, { gutter: computed(() => 0) })\nconst ns = useNamespace('col')\n\nconst style = computed(() => {\n const styles: CSSProperties = {}\n if (gutter.value) {\n styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`\n }\n return styles\n})\n\nconst colKls = computed(() => {\n const classes: string[] = []\n const pos = ['span', 'offset', 'pull', 'push'] as const\n\n pos.forEach((prop) => {\n const size = props[prop]\n if (isNumber(size)) {\n if (prop === 'span') classes.push(ns.b(`${props[prop]}`))\n else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`))\n }\n })\n\n const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const\n sizes.forEach((size) => {\n if (isNumber(props[size])) {\n classes.push(ns.b(`${size}-${props[size]}`))\n } else if (isObject(props[size])) {\n Object.entries(props[size]).forEach(([prop, sizeProp]) => {\n classes.push(\n prop !== 'span'\n ? ns.b(`${size}-${prop}-${sizeProp}`)\n : ns.b(`${size}-${sizeProp}`)\n )\n })\n }\n })\n\n // this is for the fix\n if (gutter.value) {\n classes.push(ns.is('guttered'))\n }\n return [ns.b(), classes]\n})\n</script>\n"],"mappings":";;;;;;;;;;;;EAmBA,MAAM,QAAQ;EAad,MAAM,EAAE,WAAW,OAAO,eAAe,EAAE,QAAQ,eAAe,EAAE,EAAE,CAAA;EACtE,MAAM,KAAK,aAAa,MAAK;EAE7B,MAAM,QAAQ,eAAe;GAC3B,MAAM,SAAwB,EAAC;AAC/B,OAAI,OAAO,MACT,QAAO,cAAc,OAAO,eAAe,GAAG,OAAO,QAAQ,EAAE;AAEjE,UAAO;IACR;EAED,MAAM,SAAS,eAAe;GAC5B,MAAM,UAAoB,EAAC;AAG3B,GAFY;IAAC;IAAQ;IAAU;IAAQ;IAAO,CAE1C,SAAS,SAAS;IACpB,MAAM,OAAO,MAAM;AACnB,QAAI,SAAS,KAAK,EAChB;SAAI,SAAS,OAAQ,SAAQ,KAAK,GAAG,EAAE,GAAG,MAAM,QAAQ,CAAA;cAC/C,OAAO,EAAG,SAAQ,KAAK,GAAG,EAAE,GAAG,KAAK,GAAG,MAAM,QAAQ,CAAA;;KAEjE;AAGD,GADc;IAAC;IAAM;IAAM;IAAM;IAAM;IAAK,CACtC,SAAS,SAAS;AACtB,QAAI,SAAS,MAAM,MAAM,CACvB,SAAQ,KAAK,GAAG,EAAE,GAAG,KAAK,GAAG,MAAM,QAAQ,CAAA;aAClC,SAAS,MAAM,MAAM,CAC9B,QAAO,QAAQ,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,cAAc;AACxD,aAAQ,KACN,SAAS,SACL,GAAG,EAAE,GAAG,KAAK,GAAG,KAAK,GAAG,WAAU,GAClC,GAAG,EAAE,GAAG,KAAK,GAAG,WAAU,CAChC;MACD;KAEJ;AAGD,OAAI,OAAO,MACT,SAAQ,KAAK,GAAG,GAAG,WAAW,CAAA;AAEhC,UAAO,CAAC,GAAG,GAAG,EAAE,QAAO;IACxB;;uBA1EC,YAEY,wBAFI,QAAA,IAAG,EAAA;IAAG,OAAK,eAAE,OAAA,MAAM;IAAG,OAAK,eAAE,MAAA,MAAK;;2BACxC,CAAR,WAAQ,KAAA,QAAA,UAAA"}
+8
View File
@@ -0,0 +1,8 @@
import col_vue_vue_type_script_setup_true_lang_default from "./col.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/col/src/col.vue
var col_default = col_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { col_default as default };
//# sourceMappingURL=col2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"col2.mjs","names":[],"sources":["../../../../../../packages/components/col/src/col.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"colKls\" :style=\"style\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rowContextKey } from '@element-plus/components/row'\n\nimport type { CSSProperties } from 'vue'\nimport type { ColProps } from './col'\n\ndefineOptions({\n name: 'ElCol',\n})\n\nconst props = withDefaults(defineProps<ColProps>(), {\n tag: 'div',\n span: 24,\n offset: 0,\n pull: 0,\n push: 0,\n xs: () => ({}),\n sm: () => ({}),\n md: () => ({}),\n lg: () => ({}),\n xl: () => ({}),\n})\n\nconst { gutter } = inject(rowContextKey, { gutter: computed(() => 0) })\nconst ns = useNamespace('col')\n\nconst style = computed(() => {\n const styles: CSSProperties = {}\n if (gutter.value) {\n styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`\n }\n return styles\n})\n\nconst colKls = computed(() => {\n const classes: string[] = []\n const pos = ['span', 'offset', 'pull', 'push'] as const\n\n pos.forEach((prop) => {\n const size = props[prop]\n if (isNumber(size)) {\n if (prop === 'span') classes.push(ns.b(`${props[prop]}`))\n else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`))\n }\n })\n\n const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const\n sizes.forEach((size) => {\n if (isNumber(props[size])) {\n classes.push(ns.b(`${size}-${props[size]}`))\n } else if (isObject(props[size])) {\n Object.entries(props[size]).forEach(([prop, sizeProp]) => {\n classes.push(\n prop !== 'span'\n ? ns.b(`${size}-${prop}-${sizeProp}`)\n : ns.b(`${size}-${sizeProp}`)\n )\n })\n }\n })\n\n // this is for the fix\n if (gutter.value) {\n classes.push(ns.is('guttered'))\n }\n return [ns.b(), classes]\n})\n</script>\n"],"mappings":""}
+2
View File
@@ -0,0 +1,2 @@
import "../../base/style/css.mjs";
import "element-plus/theme-chalk/el-col.css";
+2
View File
@@ -0,0 +1,2 @@
import "../../base/style/index.mjs";
import "element-plus/theme-chalk/src/col.scss";