ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
52 lines (51 loc) • 1.34 kB
JavaScript
import r from "../../../../vc-util/Dom/canUseDom.mjs";
import { ATTR_MARK as u } from "../../StyleContext.mjs";
const l = "data-ant-cssinjs-cache-path", f = "_FILE_STYLE__";
function h(t) {
return Object.keys(t).map((e) => {
const n = t[e];
return `${e}:${n}`;
}).join(";");
}
let o, s = !0;
function S(t, e = !0) {
o = t, s = e;
}
function m() {
var t;
if (!o && (o = {}, r())) {
const e = document.createElement("div");
e.className = l, e.style.position = "fixed", e.style.visibility = "hidden", e.style.top = "-9999px", document.body.appendChild(e);
let n = getComputedStyle(e).content || "";
n = n.replace(/^"/, "").replace(/"$/, ""), n.split(";").forEach((c) => {
const [a, d] = c.split(":");
o[a] = d;
});
const i = document.querySelector(`style[${l}]`);
i && (s = !1, (t = i.parentNode) == null || t.removeChild(i)), document.body.removeChild(e);
}
}
function _(t) {
return m(), !!o[t];
}
function C(t) {
const e = o[t];
let n = null;
if (e && r())
if (s)
n = f;
else {
const i = document.querySelector(`style[${u}="${o[t]}"]`);
i ? n = i.innerHTML : delete o[t];
}
return [n, e];
}
export {
l as ATTR_CACHE_MAP,
f as CSS_FILE_STYLE,
_ as existPath,
C as getStyleAndHash,
m as prepare,
S as reset,
h as serialize
};