完全跑通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,18 @@
import * as _$vue from "vue";
import { InjectionKey, Ref } from "vue";
//#region ../../packages/hooks/use-z-index/index.d.ts
interface ElZIndexInjectionContext {
current: number;
}
declare const defaultInitialZIndex = 2000;
declare const ZINDEX_INJECTION_KEY: InjectionKey<ElZIndexInjectionContext>;
declare const zIndexContextKey: InjectionKey<Ref<number | undefined>>;
declare const useZIndex: (zIndexOverrides?: Ref<number>) => {
initialZIndex: _$vue.ComputedRef<number>;
currentZIndex: _$vue.ComputedRef<number>;
nextZIndex: () => number;
};
type UseZIndexReturn = ReturnType<typeof useZIndex>;
//#endregion
export { ElZIndexInjectionContext, UseZIndexReturn, ZINDEX_INJECTION_KEY, defaultInitialZIndex, useZIndex, zIndexContextKey };

View File

@@ -0,0 +1,40 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../_virtual/_rolldown/runtime.js");
const require_types = require("../../utils/types.js");
const require_error = require("../../utils/error.js");
let vue = require("vue");
let _vueuse_core = require("@vueuse/core");
//#region ../../packages/hooks/use-z-index/index.ts
const initial = { current: 0 };
const zIndex = (0, vue.ref)(0);
const defaultInitialZIndex = 2e3;
const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
const zIndexContextKey = Symbol("zIndexContextKey");
const useZIndex = (zIndexOverrides) => {
const increasingInjection = (0, vue.getCurrentInstance)() ? (0, vue.inject)(ZINDEX_INJECTION_KEY, initial) : initial;
const zIndexInjection = zIndexOverrides || ((0, vue.getCurrentInstance)() ? (0, vue.inject)(zIndexContextKey, void 0) : void 0);
const initialZIndex = (0, vue.computed)(() => {
const zIndexFromInjection = (0, vue.unref)(zIndexInjection);
return require_types.isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
});
const currentZIndex = (0, vue.computed)(() => initialZIndex.value + zIndex.value);
const nextZIndex = () => {
increasingInjection.current++;
zIndex.value = increasingInjection.current;
return currentZIndex.value;
};
if (!_vueuse_core.isClient && !(0, vue.inject)(ZINDEX_INJECTION_KEY)) require_error.debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
return {
initialZIndex,
currentZIndex,
nextZIndex
};
};
//#endregion
exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
exports.defaultInitialZIndex = defaultInitialZIndex;
exports.useZIndex = useZIndex;
exports.zIndexContextKey = zIndexContextKey;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["isNumber","isClient"],"sources":["../../../../../packages/hooks/use-z-index/index.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, ref, unref } from 'vue'\nimport { debugWarn, isClient, isNumber } from '@element-plus/utils'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nexport interface ElZIndexInjectionContext {\n current: number\n}\n\nconst initial: ElZIndexInjectionContext = {\n current: 0,\n}\n\nconst zIndex = ref(0)\n\nexport const defaultInitialZIndex = 2000\n\n// For SSR\nexport const ZINDEX_INJECTION_KEY: InjectionKey<ElZIndexInjectionContext> =\n Symbol('elZIndexContextKey')\n\nexport const zIndexContextKey: InjectionKey<Ref<number | undefined>> =\n Symbol('zIndexContextKey')\n\nexport const useZIndex = (zIndexOverrides?: Ref<number>) => {\n const increasingInjection = getCurrentInstance()\n ? inject(ZINDEX_INJECTION_KEY, initial)\n : initial\n\n const zIndexInjection =\n zIndexOverrides ||\n (getCurrentInstance() ? inject(zIndexContextKey, undefined) : undefined)\n\n const initialZIndex = computed(() => {\n const zIndexFromInjection = unref(zIndexInjection)\n return isNumber(zIndexFromInjection)\n ? zIndexFromInjection\n : defaultInitialZIndex\n })\n\n const currentZIndex = computed(() => initialZIndex.value + zIndex.value)\n\n const nextZIndex = () => {\n increasingInjection.current++\n zIndex.value = increasingInjection.current\n return currentZIndex.value\n }\n\n if (!isClient && !inject(ZINDEX_INJECTION_KEY)) {\n debugWarn(\n 'ZIndexInjection',\n `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed\nusage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`\n )\n }\n\n return {\n initialZIndex,\n currentZIndex,\n nextZIndex,\n }\n}\n\nexport type UseZIndexReturn = ReturnType<typeof useZIndex>\n"],"mappings":";;;;;;;AASA,MAAM,UAAoC,EACxC,SAAS,GACV;AAED,MAAM,UAAA,GAAA,IAAA,KAAa,EAAE;AAErB,MAAa,uBAAuB;AAGpC,MAAa,uBACX,OAAO,qBAAqB;AAE9B,MAAa,mBACX,OAAO,mBAAmB;AAE5B,MAAa,aAAa,oBAAkC;CAC1D,MAAM,uBAAA,GAAA,IAAA,qBAA0C,IAAA,GAAA,IAAA,QACrC,sBAAsB,QAAQ,GACrC;CAEJ,MAAM,kBACJ,qBAAA,GAAA,IAAA,qBACqB,IAAA,GAAA,IAAA,QAAU,kBAAkB,KAAA,EAAU,GAAG,KAAA;CAEhE,MAAM,iBAAA,GAAA,IAAA,gBAA+B;EACnC,MAAM,uBAAA,GAAA,IAAA,OAA4B,gBAAgB;EAClD,OAAOA,cAAAA,SAAS,oBAAoB,GAChC,sBACA;GACJ;CAEF,MAAM,iBAAA,GAAA,IAAA,gBAA+B,cAAc,QAAQ,OAAO,MAAM;CAExE,MAAM,mBAAmB;EACvB,oBAAoB;EACpB,OAAO,QAAQ,oBAAoB;EACnC,OAAO,cAAc;;CAGvB,IAAI,CAACC,aAAAA,YAAY,EAAA,GAAA,IAAA,QAAQ,qBAAqB,EAC5C,cAAA,UACE,mBACA;0DAED;CAGH,OAAO;EACL;EACA;EACA;EACD"}