UNPKG

comic-plus

Version:

<p align="center"> <img width="200px" src="./logo.png"/> </p>

43 lines (42 loc) 1.17 kB
import "../icons/index.mjs"; import { computed } from "vue"; import { Loading } from "../icons/components/components.mjs"; const useGlobal = () => { const COMIC = window["$COMIC"]; const globalSize = computed(() => { return COMIC == null ? void 0 : COMIC.size; }); const globalLoadingRender = computed(() => { return (COMIC == null ? void 0 : COMIC.loadingRender) || Loading; }); return { globalSize, globalLoadingRender }; }; const getMaxZIndex = (dom = document) => { const allElement = Array.from(dom.querySelectorAll("*")); const zIndexArray = []; allElement.forEach((item) => { const itemZIndex = Number(window.getComputedStyle(item, null).getPropertyValue("z-index")); if (itemZIndex) { zIndexArray.push(itemZIndex); } }); let maxZIndex = 0; if (zIndexArray.length) { maxZIndex = Math.max(...zIndexArray); } return maxZIndex + 1; }; const defaultZindex = computed(() => { var _a; return ((_a = window["$COMIC"]) == null ? void 0 : _a.zIndex) ?? 2e3; }); let zIndex = 0; const getNextZIndex = () => defaultZindex.value + ++zIndex; export { getMaxZIndex, getNextZIndex, useGlobal };