完全跑通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,13 @@
import * as _$vue from "vue";
//#region ../../packages/hooks/use-popper-container/index.d.ts
declare const usePopperContainerId: () => {
id: _$vue.ComputedRef<string>;
selector: _$vue.ComputedRef<string>;
};
declare const usePopperContainer: () => {
id: _$vue.ComputedRef<string>;
selector: _$vue.ComputedRef<string>;
};
//#endregion
export { usePopperContainer, usePopperContainerId };

View File

@@ -0,0 +1,40 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../use-namespace/index.js");
const require_index$1 = require("../use-id/index.js");
let vue = require("vue");
let _vueuse_core = require("@vueuse/core");
//#region ../../packages/hooks/use-popper-container/index.ts
const usePopperContainerId = () => {
const namespace = require_index.useGetDerivedNamespace();
const idInjection = require_index$1.useIdInjection();
const id = (0, vue.computed)(() => {
return `${namespace.value}-popper-container-${idInjection.prefix}`;
});
return {
id,
selector: (0, vue.computed)(() => `#${id.value}`)
};
};
const createContainer = (id) => {
const container = document.createElement("div");
container.id = id;
document.body.appendChild(container);
return container;
};
const usePopperContainer = () => {
const { id, selector } = usePopperContainerId();
(0, vue.onBeforeMount)(() => {
if (!_vueuse_core.isClient) return;
if (process.env.NODE_ENV === "test" || !document.body.querySelector(selector.value)) createContainer(id.value);
});
return {
id,
selector
};
};
//#endregion
exports.usePopperContainer = usePopperContainer;
exports.usePopperContainerId = usePopperContainerId;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["useGetDerivedNamespace","useIdInjection","isClient"],"sources":["../../../../../packages/hooks/use-popper-container/index.ts"],"sourcesContent":["import { computed, onBeforeMount } from 'vue'\nimport { isClient } from '@element-plus/utils'\nimport { useGetDerivedNamespace } from '../use-namespace'\nimport { useIdInjection } from '../use-id'\n\nexport const usePopperContainerId = () => {\n const namespace = useGetDerivedNamespace()\n const idInjection = useIdInjection()\n\n const id = computed(() => {\n return `${namespace.value}-popper-container-${idInjection.prefix}`\n })\n const selector = computed(() => `#${id.value}`)\n\n return {\n id,\n selector,\n }\n}\n\nconst createContainer = (id: string) => {\n const container = document.createElement('div')\n container.id = id\n document.body.appendChild(container)\n return container\n}\n\nexport const usePopperContainer = () => {\n const { id, selector } = usePopperContainerId()\n onBeforeMount(() => {\n if (!isClient) return\n\n // This is for bypassing the error that when under testing env, we often encounter\n // document.body.innerHTML = '' situation\n // for this we need to disable the caching since it's not really needed\n if (\n process.env.NODE_ENV === 'test' ||\n !document.body.querySelector(selector.value)\n ) {\n createContainer(id.value)\n }\n })\n\n return {\n id,\n selector,\n }\n}\n"],"mappings":";;;;;;;AAKA,MAAa,6BAA6B;CACxC,MAAM,YAAYA,cAAAA,wBAAwB;CAC1C,MAAM,cAAcC,gBAAAA,gBAAgB;CAEpC,MAAM,MAAA,GAAA,IAAA,gBAAoB;EACxB,OAAO,GAAG,UAAU,MAAM,oBAAoB,YAAY;GAC1D;CAGF,OAAO;EACL;EACA,WAAA,GAAA,IAAA,gBAJ8B,IAAI,GAAG,QAI7B;EACT;;AAGH,MAAM,mBAAmB,OAAe;CACtC,MAAM,YAAY,SAAS,cAAc,MAAM;CAC/C,UAAU,KAAK;CACf,SAAS,KAAK,YAAY,UAAU;CACpC,OAAO;;AAGT,MAAa,2BAA2B;CACtC,MAAM,EAAE,IAAI,aAAa,sBAAsB;CAC/C,CAAA,GAAA,IAAA,qBAAoB;EAClB,IAAI,CAACC,aAAAA,UAAU;EAKf,IACE,QAAQ,IAAI,aAAa,UACzB,CAAC,SAAS,KAAK,cAAc,SAAS,MAAM,EAE5C,gBAAgB,GAAG,MAAM;GAE3B;CAEF,OAAO;EACL;EACA;EACD"}