ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
103 lines (102 loc) • 3.23 kB
JavaScript
import { m as C } from "./hooks/useCacheToken.tsx2.mjs";
import { updateCSS as T, removeCSS as A } from "../../vc-util/Dom/dynamicCSS.mjs";
import b from "../../vc-util/Dom/canUseDom.mjs";
import "./theme/ThemeCache.mjs";
import j from "./theme/Theme.mjs";
const v = "data-token-hash", O = "data-css-hash", Z = "data-cache-path", y = /* @__PURE__ */ new WeakMap();
function h(t) {
let r = y.get(t) || "";
return r || (Object.keys(t).forEach((e) => {
const s = t[e];
r += e, s instanceof j ? r += s.id : s && typeof s == "object" ? r += h(s) : r += s;
}), y.set(t, r)), r;
}
function k(t, r) {
return C(`${r}_${h(t)}`);
}
const c = `random-${Date.now()}-${Math.random()}`.replace(/\./g, ""), $ = "_bAmBoO_";
function d(t, r, e) {
var s, n;
if (b()) {
T(t, c);
const o = document.createElement("div");
o.style.position = "fixed", o.style.left = "0", o.style.top = "0", r == null || r(o), document.body.appendChild(o);
const a = e ? e(o) : (s = getComputedStyle(o).content) == null ? void 0 : s.includes($);
return (n = o.parentNode) == null || n.removeChild(o), A(c), a;
}
return !1;
}
let i;
function K() {
return i === void 0 && (i = d(
`@layer ${c} { .${c} { content: "${$}"!important; } }`,
(t) => {
t.className = c;
}
)), i;
}
let l;
function M() {
return l === void 0 && (l = d(
`:where(.${c}) { content: "${$}"!important; }`,
(t) => {
t.className = c;
}
)), l;
}
let m;
function V() {
return m === void 0 && (m = d(
`.${c} { inset-block: 93px !important; }`,
(t) => {
t.className = c;
},
(t) => getComputedStyle(t).bottom === "93px"
)), m;
}
const W = b();
function D(t) {
return typeof t == "number" ? `${t}px` : t;
}
const _ = (t, r = "") => `--${r ? `${r}-` : ""}${t}`.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1-$2").replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase();
function H(t, r, e, s = {}, n = !1) {
if (n)
return t;
const o = {
...s,
[v]: r,
[O]: e
};
return `<style ${Object.keys(o).map((p) => {
const u = o[p];
return u ? `${p}="${u}"` : null;
}).filter((p) => p).join(" ")}>${t}</style>`;
}
const x = (t, r, e) => Object.keys(t).length ? `.${r}${e != null && e.scope ? `.${e.scope}` : ""}{${Object.entries(t).map(([s, n]) => `${s}:${n};`).join("")}}` : "", P = (t, r, e) => {
const s = {}, n = {};
return Object.entries(t).forEach(([o, a]) => {
var p, u, S;
if ((p = e == null ? void 0 : e.preserve) != null && p[o])
n[o] = a;
else if ((typeof a == "string" || typeof a == "number") && !((u = e == null ? void 0 : e.ignore) != null && u[o])) {
const f = _(o, e == null ? void 0 : e.prefix);
s[f] = typeof a == "number" && !((S = e == null ? void 0 : e.unitless) != null && S[o]) ? `${a}px` : String(a), n[o] = `var(${f})`;
}
}), [n, x(s, r, { scope: e == null ? void 0 : e.scope })];
};
export {
Z as ATTR_CACHE_PATH,
O as ATTR_MARK,
v as ATTR_TOKEN,
h as flattenToken,
W as isClientSide,
x as serializeCSSVar,
K as supportLayer,
V as supportLogicProps,
M as supportWhere,
H as toStyleStr,
_ as token2CSSVar,
k as token2key,
P as transformToken,
D as unit
};