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 { BacktopEmits, BacktopProps, BacktopPropsPublic, backtopEmits, backtopProps } from "./src/backtop.js";
import { _default } from "./src/backtop.vue.js";
import { BacktopInstance } from "./src/instance.js";
//#region ../../packages/components/backtop/index.d.ts
declare const ElBacktop: SFCWithInstall<typeof _default>;
//#endregion
export { BacktopEmits, type BacktopInstance, BacktopProps, BacktopPropsPublic, ElBacktop, ElBacktop as default, backtopEmits, backtopProps };
+14
View File
@@ -0,0 +1,14 @@
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const require_install = require('../../utils/vue/install.js');
const require_backtop = require('./src/backtop.js');
const require_backtop$1 = require('./src/backtop2.js');
//#region ../../packages/components/backtop/index.ts
const ElBacktop = require_install.withInstall(require_backtop$1.default);
//#endregion
exports.ElBacktop = ElBacktop;
exports.default = ElBacktop;
exports.backtopEmits = require_backtop.backtopEmits;
exports.backtopProps = require_backtop.backtopProps;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["withInstall","Backtop"],"sources":["../../../../../packages/components/backtop/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Backtop from './src/backtop.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElBacktop: SFCWithInstall<typeof Backtop> = withInstall(Backtop)\nexport default ElBacktop\n\nexport * from './src/backtop'\nexport type { BacktopInstance } from './src/instance'\n"],"mappings":";;;;;;AAKA,MAAa,YAA4CA,4BAAYC,0BAAQ"}
@@ -0,0 +1,64 @@
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/backtop/src/backtop.d.ts
interface BacktopProps {
/**
* @description the button will not show until the scroll height reaches this value.
*/
visibilityHeight?: number;
/**
* @description the target to trigger scroll.
*/
target?: string;
/**
* @description right distance.
*/
right?: number;
/**
* @description bottom distance.
*/
bottom?: number;
}
/**
* @deprecated Removed after 3.0.0, Use `BacktopProps` instead.
*/
declare const backtopProps: {
/**
* @description the button will not show until the scroll height reaches this value.
*/
readonly visibilityHeight: {
readonly type: NumberConstructor;
readonly default: 200;
};
/**
* @description the target to trigger scroll.
*/
readonly target: {
readonly type: StringConstructor;
readonly default: "";
};
/**
* @description right distance.
*/
readonly right: {
readonly type: NumberConstructor;
readonly default: 40;
};
/**
* @description bottom distance.
*/
readonly bottom: {
readonly type: NumberConstructor;
readonly default: 40;
};
};
/**
* @deprecated Removed after 3.0.0, Use `BacktopProps` instead.
*/
type BacktopPropsPublic = ExtractPublicPropTypes<typeof backtopProps>;
declare const backtopEmits: {
click: (evt: MouseEvent) => boolean;
};
type BacktopEmits = typeof backtopEmits;
//#endregion
export { BacktopEmits, BacktopProps, BacktopPropsPublic, backtopEmits, backtopProps };
@@ -0,0 +1,30 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region ../../packages/components/backtop/src/backtop.ts
/**
* @deprecated Removed after 3.0.0, Use `BacktopProps` instead.
*/
const backtopProps = {
visibilityHeight: {
type: Number,
default: 200
},
target: {
type: String,
default: ""
},
right: {
type: Number,
default: 40
},
bottom: {
type: Number,
default: 40
}
};
const backtopEmits = { click: (evt) => evt instanceof MouseEvent };
//#endregion
exports.backtopEmits = backtopEmits;
exports.backtopProps = backtopProps;
//# sourceMappingURL=backtop.js.map
@@ -0,0 +1 @@
{"version":3,"file":"backtop.js","names":[],"sources":["../../../../../../packages/components/backtop/src/backtop.ts"],"sourcesContent":["import type { ExtractPublicPropTypes } from 'vue'\n\nexport interface BacktopProps {\n /**\n * @description the button will not show until the scroll height reaches this value.\n */\n visibilityHeight?: number\n /**\n * @description the target to trigger scroll.\n */\n target?: string\n /**\n * @description right distance.\n */\n right?: number\n /**\n * @description bottom distance.\n */\n bottom?: number\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `BacktopProps` instead.\n */\nexport const backtopProps = {\n /**\n * @description the button will not show until the scroll height reaches this value.\n */\n visibilityHeight: {\n type: Number,\n default: 200,\n },\n /**\n * @description the target to trigger scroll.\n */\n target: {\n type: String,\n default: '',\n },\n /**\n * @description right distance.\n */\n right: {\n type: Number,\n default: 40,\n },\n /**\n * @description bottom distance.\n */\n bottom: {\n type: Number,\n default: 40,\n },\n} as const\n\n/**\n * @deprecated Removed after 3.0.0, Use `BacktopProps` instead.\n */\nexport type BacktopPropsPublic = ExtractPublicPropTypes<typeof backtopProps>\n\nexport const backtopEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type BacktopEmits = typeof backtopEmits\n"],"mappings":";;;;;;AAwBA,MAAa,eAAe;CAI1B,kBAAkB;EAChB,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CACF;AAOD,MAAa,eAAe,EAC1B,QAAQ,QAAoB,eAAe,YAC5C"}
@@ -0,0 +1,27 @@
import { BacktopProps } from "./backtop.js";
import * as vue from "vue";
//#region ../../packages/components/backtop/src/backtop.vue.d.ts
declare var __VLS_7: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_7) => any;
};
declare const __VLS_base: vue.DefineComponent<BacktopProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
click: (evt: MouseEvent) => void;
}, string, vue.PublicProps, Readonly<BacktopProps> & Readonly<{
onClick?: ((evt: MouseEvent) => any) | undefined;
}>, {
target: string;
bottom: number;
right: number;
visibilityHeight: number;
}, {}, {}, {}, 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,44 @@
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
const require_index = require('../../../hooks/use-namespace/index.js');
const require_index$1 = require('../../icon/index.js');
const require_backtop = require('./backtop.js');
const require_use_backtop = require('./use-backtop.js');
let _element_plus_icons_vue = require("@element-plus/icons-vue");
let vue = require("vue");
//#region ../../packages/components/backtop/src/backtop.vue?vue&type=script&setup=true&lang.ts
const COMPONENT_NAME = "ElBacktop";
var backtop_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: COMPONENT_NAME,
__name: "backtop",
props: require_backtop.backtopProps,
emits: require_backtop.backtopEmits,
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const ns = require_index.useNamespace("backtop");
const { handleClick, visible } = require_use_backtop.useBackTop(props, emit, COMPONENT_NAME);
const backTopStyle = (0, vue.computed)(() => ({
right: `${props.right}px`,
bottom: `${props.bottom}px`
}));
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Transition, { name: `${(0, vue.unref)(ns).namespace.value}-fade-in` }, {
default: (0, vue.withCtx)(() => [(0, vue.unref)(visible) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
key: 0,
style: (0, vue.normalizeStyle)(backTopStyle.value),
class: (0, vue.normalizeClass)((0, vue.unref)(ns).b()),
onClick: _cache[0] || (_cache[0] = (0, vue.withModifiers)((...args) => (0, vue.unref)(handleClick) && (0, vue.unref)(handleClick)(...args), ["stop"]))
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [(0, vue.createVNode)((0, vue.unref)(require_index$1.ElIcon), { class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("icon")) }, {
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_element_plus_icons_vue.CaretTop))]),
_: 1
}, 8, ["class"])])], 6)) : (0, vue.createCommentVNode)("v-if", true)]),
_: 3
}, 8, ["name"]);
};
}
});
//#endregion
exports.default = backtop_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=backtop.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
{"version":3,"file":"backtop.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/backtop/src/backtop.vue"],"sourcesContent":["<template>\n <transition :name=\"`${ns.namespace.value}-fade-in`\">\n <div\n v-if=\"visible\"\n :style=\"backTopStyle\"\n :class=\"ns.b()\"\n @click.stop=\"handleClick\"\n >\n <slot>\n <el-icon :class=\"ns.e('icon')\"><caret-top /></el-icon>\n </slot>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { CaretTop } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { backtopEmits } from './backtop'\nimport { useBackTop } from './use-backtop'\n\nimport type { BacktopProps } from './backtop'\n\nconst COMPONENT_NAME = 'ElBacktop'\n\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = withDefaults(defineProps<BacktopProps>(), {\n visibilityHeight: 200,\n target: '',\n right: 40,\n bottom: 40,\n})\nconst emit = defineEmits(backtopEmits)\n\nconst ns = useNamespace('backtop')\n\nconst { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME)\n\nconst backTopStyle = computed(() => ({\n right: `${props.right}px`,\n bottom: `${props.bottom}px`,\n}))\n</script>\n"],"mappings":";;;;;;;;;AAyBA,MAAM,iBAAiB;;;;;;;EAMvB,MAAM,QAAQ;EAMd,MAAM,OAAO;EAEb,MAAM,KAAK,2BAAa,UAAS;EAEjC,MAAM,EAAE,aAAa,YAAY,+BAAW,OAAO,MAAM,eAAc;EAEvE,MAAM,wCAA+B;GACnC,OAAO,GAAG,MAAM,MAAM;GACtB,QAAQ,GAAG,MAAM,OAAO;GACzB,EAAC;;qDAlCa,gBAAA,EAXA,MAAI,kBAAK,GAAE,CAAC,UAAU,MAAK;oCAUhC,gBARE,QAAO,sDAQT,OAAA;;KAPH,+BAAO,aAAA,MAAY;KACnB,8CAAO,GAAE,CAAC,GAAC,CAAA;KACX,SAAK,OAAA,OAAA,OAAA,wDAAO,YAAA,mBAAA,YAAA,CAAA,GAAA,KAAW,EAAA,CAAA,OAAA,CAAA;4BAIjB,KAAA,QAAA,WAAA,EAAA,QAAA,qCADiD,uBAAA,EAAA,EAA5C,8CAAO,GAAE,CAAC,EAAC,OAAA,CAAA;qCAAuB,qCAAA,iCAAA,CAAA"}
@@ -0,0 +1,9 @@
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const require_backtop_vue_vue_type_script_setup_true_lang = require('./backtop.vue_vue_type_script_setup_true_lang.js');
//#region ../../packages/components/backtop/src/backtop.vue
var backtop_default = require_backtop_vue_vue_type_script_setup_true_lang.default;
//#endregion
exports.default = backtop_default;
//# sourceMappingURL=backtop2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"backtop2.js","names":[],"sources":["../../../../../../packages/components/backtop/src/backtop.vue"],"sourcesContent":["<template>\n <transition :name=\"`${ns.namespace.value}-fade-in`\">\n <div\n v-if=\"visible\"\n :style=\"backTopStyle\"\n :class=\"ns.b()\"\n @click.stop=\"handleClick\"\n >\n <slot>\n <el-icon :class=\"ns.e('icon')\"><caret-top /></el-icon>\n </slot>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { CaretTop } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { backtopEmits } from './backtop'\nimport { useBackTop } from './use-backtop'\n\nimport type { BacktopProps } from './backtop'\n\nconst COMPONENT_NAME = 'ElBacktop'\n\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = withDefaults(defineProps<BacktopProps>(), {\n visibilityHeight: 200,\n target: '',\n right: 40,\n bottom: 40,\n})\nconst emit = defineEmits(backtopEmits)\n\nconst ns = useNamespace('backtop')\n\nconst { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME)\n\nconst backTopStyle = computed(() => ({\n right: `${props.right}px`,\n bottom: `${props.bottom}px`,\n}))\n</script>\n"],"mappings":""}
@@ -0,0 +1,6 @@
import { _default } from "./backtop.vue.js";
//#region ../../packages/components/backtop/src/instance.d.ts
type BacktopInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { BacktopInstance };
@@ -0,0 +1 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -0,0 +1,41 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
const require_error = require('../../../utils/error.js');
let _vueuse_core = require("@vueuse/core");
let vue = require("vue");
//#region ../../packages/components/backtop/src/use-backtop.ts
const useBackTop = (props, emit, componentName) => {
const el = (0, vue.shallowRef)();
const container = (0, vue.shallowRef)();
const visible = (0, vue.ref)(false);
const handleScroll = () => {
if (el.value) visible.value = el.value.scrollTop >= props.visibilityHeight;
};
const handleClick = (event) => {
el.value?.scrollTo({
top: 0,
behavior: "smooth"
});
emit("click", event);
};
(0, _vueuse_core.useEventListener)(container, "scroll", (0, _vueuse_core.useThrottleFn)(handleScroll, 300, true));
(0, vue.onMounted)(() => {
container.value = document;
el.value = document.documentElement;
if (props.target) {
el.value = document.querySelector(props.target) ?? void 0;
if (!el.value) require_error.throwError(componentName, `target does not exist: ${props.target}`);
container.value = el.value;
}
handleScroll();
});
return {
visible,
handleClick
};
};
//#endregion
exports.useBackTop = useBackTop;
//# sourceMappingURL=use-backtop.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-backtop.js","names":[],"sources":["../../../../../../packages/components/backtop/src/use-backtop.ts"],"sourcesContent":["import { onMounted, ref, shallowRef } from 'vue'\nimport { useEventListener, useThrottleFn } from '@vueuse/core'\nimport { throwError } from '@element-plus/utils'\n\nimport type { SetupContext } from 'vue'\nimport type { BacktopEmits, BacktopProps } from './backtop'\n\nexport const useBackTop = (\n props: Required<BacktopProps>,\n emit: SetupContext<BacktopEmits>['emit'],\n componentName: string\n) => {\n const el = shallowRef<HTMLElement>()\n const container = shallowRef<Document | HTMLElement>()\n const visible = ref(false)\n\n const handleScroll = () => {\n if (el.value) visible.value = el.value.scrollTop >= props.visibilityHeight\n }\n\n const handleClick = (event: MouseEvent) => {\n el.value?.scrollTo({ top: 0, behavior: 'smooth' })\n emit('click', event)\n }\n\n const handleScrollThrottled = useThrottleFn(handleScroll, 300, true)\n\n useEventListener(container, 'scroll', handleScrollThrottled)\n onMounted(() => {\n container.value = document\n el.value = document.documentElement\n\n if (props.target) {\n el.value = document.querySelector<HTMLElement>(props.target) ?? undefined\n if (!el.value) {\n throwError(componentName, `target does not exist: ${props.target}`)\n }\n container.value = el.value\n }\n // Give visible an initial value, fix #13066\n handleScroll()\n })\n\n return {\n visible,\n handleClick,\n }\n}\n"],"mappings":";;;;;;;AAOA,MAAa,cACX,OACA,MACA,kBACG;CACH,MAAM,0BAA8B;CACpC,MAAM,iCAAgD;CACtD,MAAM,uBAAc,MAAM;CAE1B,MAAM,qBAAqB;AACzB,MAAI,GAAG,MAAO,SAAQ,QAAQ,GAAG,MAAM,aAAa,MAAM;;CAG5D,MAAM,eAAe,UAAsB;AACzC,KAAG,OAAO,SAAS;GAAE,KAAK;GAAG,UAAU;GAAU,CAAC;AAClD,OAAK,SAAS,MAAM;;AAKtB,oCAAiB,WAAW,0CAFgB,cAAc,KAAK,KAAK,CAER;AAC5D,0BAAgB;AACd,YAAU,QAAQ;AAClB,KAAG,QAAQ,SAAS;AAEpB,MAAI,MAAM,QAAQ;AAChB,MAAG,QAAQ,SAAS,cAA2B,MAAM,OAAO,IAAI;AAChE,OAAI,CAAC,GAAG,MACN,0BAAW,eAAe,0BAA0B,MAAM,SAAS;AAErE,aAAU,QAAQ,GAAG;;AAGvB,gBAAc;GACd;AAEF,QAAO;EACL;EACA;EACD"}
@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
require('../../base/style/css.js');
require("element-plus/theme-chalk/el-backtop.css");
@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
require('../../base/style/index.js');
require("element-plus/theme-chalk/src/backtop.scss");