完全跑通1.0版本

This commit is contained in:
2026-05-26 12:56:03 +08:00
parent 2ece5174a7
commit 93c714a93b
11557 changed files with 1648225 additions and 36 deletions

View File

@@ -0,0 +1,9 @@
import { SFCWithInstall } from "../../utils/vue/typescript.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 };

View File

@@ -0,0 +1,16 @@
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

View File

@@ -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,gBAAAA,YAAYC,kBAAAA,QAAQ"}

View File

@@ -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 };

View File

@@ -0,0 +1,41 @@
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 = {
/**
* @description the button will not show until the scroll height reaches this value.
*/
visibilityHeight: {
type: Number,
default: 200
},
/**
* @description the target to trigger scroll.
*/
target: {
type: String,
default: ""
},
/**
* @description right distance.
*/
right: {
type: Number,
default: 40
},
/**
* @description bottom distance.
*/
bottom: {
type: Number,
default: 40
}
};
const backtopEmits = { click: (evt) => evt instanceof MouseEvent };
//#endregion
exports.backtopEmits = backtopEmits;
exports.backtopProps = backtopProps;
//# sourceMappingURL=backtop.js.map

View File

@@ -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"}

View File

@@ -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 as default };

View File

@@ -0,0 +1,43 @@
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

View File

@@ -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,cAAA,aAAa,UAAS;EAEjC,MAAM,EAAE,aAAa,YAAY,oBAAA,WAAW,OAAO,MAAM,eAAc;EAEvE,MAAM,gBAAA,GAAA,IAAA,iBAA+B;GACnC,OAAO,GAAG,MAAM,MAAM;GACtB,QAAQ,GAAG,MAAM,OAAO;GACzB,EAAC;;qDAlCa,IAAA,YAAA,EAXA,MAAI,IAAA,GAAA,IAAA,OAAK,GAAE,CAAC,UAAU,MAAK,WAAA,EAAA;oCAUhC,EAAA,GAAA,IAAA,OARE,QAAO,KAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAQT,OAAA;;KAPH,QAAA,GAAA,IAAA,gBAAO,aAAA,MAAY;KACnB,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,GAAC,CAAA;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,gBAAA,GAAA,UAAA,GAAA,IAAA,OAAO,YAAA,KAAA,GAAA,IAAA,OAAA,YAAA,CAAA,GAAA,KAAW,EAAA,CAAA,OAAA,CAAA;4BAIjB,KAAA,QAAA,WAAA,EAAA,QAAA,EAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OADiD,gBAAA,OAAA,EAAA,EAA5C,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,OAAA,CAAA,EAAA,EAAA;qCAAuB,EAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAAA,wBAAA,SAAA,CAAA,CAAA,CAAA"}

View File

@@ -0,0 +1,10 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/backtop/src/backtop.vue
var backtop_default = require("./backtop.vue_vue_type_script_setup_true_lang.js").default;
//#endregion
exports.default = backtop_default;
//# sourceMappingURL=backtop2.js.map

View File

@@ -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":""}

View File

@@ -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 };

View File

@@ -0,0 +1 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });

View File

@@ -0,0 +1,11 @@
import { BacktopEmits, BacktopProps } from "./backtop.js";
import * as _$vue from "vue";
import { SetupContext } from "vue";
//#region ../../packages/components/backtop/src/use-backtop.d.ts
declare const useBackTop: (props: Required<BacktopProps>, emit: SetupContext<BacktopEmits>["emit"], componentName: string) => {
visible: _$vue.Ref<boolean, boolean>;
handleClick: (event: MouseEvent) => void;
};
//#endregion
export { useBackTop };

View File

@@ -0,0 +1,40 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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

View File

@@ -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,MAAA,GAAA,IAAA,aAA8B;CACpC,MAAM,aAAA,GAAA,IAAA,aAAgD;CACtD,MAAM,WAAA,GAAA,IAAA,KAAc,MAAM;CAE1B,MAAM,qBAAqB;EACzB,IAAI,GAAG,OAAO,QAAQ,QAAQ,GAAG,MAAM,aAAa,MAAM;;CAG5D,MAAM,eAAe,UAAsB;EACzC,GAAG,OAAO,SAAS;GAAE,KAAK;GAAG,UAAU;GAAU,CAAC;EAClD,KAAK,SAAS,MAAM;;CAKtB,CAAA,GAAA,aAAA,kBAAiB,WAAW,WAAA,GAAA,aAAA,eAFgB,cAAc,KAAK,KAEJ,CAAC;CAC5D,CAAA,GAAA,IAAA,iBAAgB;EACd,UAAU,QAAQ;EAClB,GAAG,QAAQ,SAAS;EAEpB,IAAI,MAAM,QAAQ;GAChB,GAAG,QAAQ,SAAS,cAA2B,MAAM,OAAO,IAAI,KAAA;GAChE,IAAI,CAAC,GAAG,OACN,cAAA,WAAW,eAAe,0BAA0B,MAAM,SAAS;GAErE,UAAU,QAAQ,GAAG;;EAGvB,cAAc;GACd;CAEF,OAAO;EACL;EACA;EACD"}

View File

@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../base/style/css.js");
require("element-plus/theme-chalk/el-backtop.css");

View File

@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../base/style/index.js");
require("element-plus/theme-chalk/src/backtop.scss");