comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
43 lines (42 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../icons/index.js");
const vue = require("vue");
const components = require("../icons/components/components.js");
const useGlobal = () => {
const COMIC = window["$COMIC"];
const globalSize = vue.computed(() => {
return COMIC == null ? void 0 : COMIC.size;
});
const globalLoadingRender = vue.computed(() => {
return (COMIC == null ? void 0 : COMIC.loadingRender) || components.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 = vue.computed(() => {
var _a;
return ((_a = window["$COMIC"]) == null ? void 0 : _a.zIndex) ?? 2e3;
});
let zIndex = 0;
const getNextZIndex = () => defaultZindex.value + ++zIndex;
exports.getMaxZIndex = getMaxZIndex;
exports.getNextZIndex = getNextZIndex;
exports.useGlobal = useGlobal;