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
+11
View File
@@ -0,0 +1,11 @@
import { Ref, VNode } from "vue";
//#region ../../packages/hooks/use-teleport/index.d.ts
declare const useTeleport: (contentRenderer: () => VNode, appendToBody: Ref<boolean>) => {
isTeleportVisible: Ref<boolean, boolean>;
showTeleport: () => void;
hideTeleport: () => void;
renderTeleport: () => void;
};
//#endregion
export { useTeleport };
+44
View File
@@ -0,0 +1,44 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
const require_global_node = require('../../utils/vue/global-node.js');
let vue = require("vue");
let _vueuse_core = require("@vueuse/core");
let _vue_shared = require("@vue/shared");
//#region ../../packages/hooks/use-teleport/index.ts
const useTeleport = (contentRenderer, appendToBody) => {
const isTeleportVisible = (0, vue.ref)(false);
if (!_vueuse_core.isClient) return {
isTeleportVisible,
showTeleport: _vue_shared.NOOP,
hideTeleport: _vue_shared.NOOP,
renderTeleport: _vue_shared.NOOP
};
let $el = null;
const showTeleport = () => {
isTeleportVisible.value = true;
if ($el !== null) return;
$el = require_global_node.createGlobalNode();
};
const hideTeleport = () => {
isTeleportVisible.value = false;
if ($el !== null) {
require_global_node.removeGlobalNode($el);
$el = null;
}
};
const renderTeleport = () => {
return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [(0, vue.h)(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
};
(0, vue.onUnmounted)(hideTeleport);
return {
isTeleportVisible,
showTeleport,
hideTeleport,
renderTeleport
};
};
//#endregion
exports.useTeleport = useTeleport;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["isClient","NOOP","createGlobalNode","Teleport"],"sources":["../../../../../packages/hooks/use-teleport/index.ts"],"sourcesContent":["import { Teleport, h, onUnmounted, ref } from 'vue'\nimport {\n NOOP,\n createGlobalNode,\n isClient,\n removeGlobalNode,\n} from '@element-plus/utils'\n\nimport type { Ref, VNode } from 'vue'\n\nexport const useTeleport = (\n contentRenderer: () => VNode,\n appendToBody: Ref<boolean>\n) => {\n const isTeleportVisible = ref(false)\n\n if (!isClient) {\n return {\n isTeleportVisible,\n showTeleport: NOOP,\n hideTeleport: NOOP,\n renderTeleport: NOOP,\n }\n }\n\n let $el: HTMLElement | null = null\n\n const showTeleport = () => {\n isTeleportVisible.value = true\n // this allows the delayed showing strategy since the the content itself could be enterable\n // e.g. el-popper\n if ($el !== null) return\n\n $el = createGlobalNode()\n }\n\n const hideTeleport = () => {\n isTeleportVisible.value = false\n if ($el !== null) {\n removeGlobalNode($el)\n $el = null\n }\n }\n\n const renderTeleport = () => {\n return appendToBody.value !== true\n ? contentRenderer()\n : isTeleportVisible.value\n ? [h(Teleport, { to: $el }, contentRenderer())]\n : undefined\n }\n\n onUnmounted(hideTeleport)\n\n return {\n isTeleportVisible,\n showTeleport,\n hideTeleport,\n renderTeleport,\n }\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,eACX,iBACA,iBACG;CACH,MAAM,iCAAwB,MAAM;AAEpC,KAAI,CAACA,sBACH,QAAO;EACL;EACA,cAAcC;EACd,cAAcA;EACd,gBAAgBA;EACjB;CAGH,IAAI,MAA0B;CAE9B,MAAM,qBAAqB;AACzB,oBAAkB,QAAQ;AAG1B,MAAI,QAAQ,KAAM;AAElB,QAAMC,sCAAkB;;CAG1B,MAAM,qBAAqB;AACzB,oBAAkB,QAAQ;AAC1B,MAAI,QAAQ,MAAM;AAChB,wCAAiB,IAAI;AACrB,SAAM;;;CAIV,MAAM,uBAAuB;AAC3B,SAAO,aAAa,UAAU,OAC1B,iBAAiB,GACjB,kBAAkB,QAChB,YAAGC,cAAU,EAAE,IAAI,KAAK,EAAE,iBAAiB,CAAC,CAAC,GAC7C;;AAGR,sBAAY,aAAa;AAEzB,QAAO;EACL;EACA;EACA;EACA;EACD"}