UNPKG

images-viewer-vue3

Version:
81 lines (80 loc) 2.56 kB
function w(f) { let m = ".", u = "__", r = "--", b; { let e = f.blockPrefix; e && (m = e), e = f.elementPrefix, e && (u = e), e = f.modifierPrefix, e && (r = e); } const d = { install(e) { b = e.c; const l = e.context; l.bem = {}, l.bem.b = null, l.bem.els = null; } }; function $(e) { let l, n; return { before(i) { l = i.bem.b, n = i.bem.els, i.bem.els = null; }, after(i) { i.bem.b = l, i.bem.els = n; }, $({ context: i, props: t }) { return e = typeof e == "string" ? e : e({ context: i, props: t }), i.bem.b = e, `${(t == null ? void 0 : t.bPrefix) || m}${i.bem.b}`; } }; } function c(e) { let l; return { before(n) { l = n.bem.els; }, after(n) { n.bem.els = l; }, $({ context: n, props: i }) { return e = typeof e == "string" ? e : e({ context: n, props: i }), n.bem.els = e.split(",").map((t) => t.trim()), n.bem.els.map((t) => `${(i == null ? void 0 : i.bPrefix) || m}${n.bem.b}${u}${t}`).join(", "); } }; } function v(e) { return { $({ context: l, props: n }) { e = typeof e == "string" ? e : e({ context: l, props: n }); const i = e.split(",").map((o) => o.trim()); function t(o) { return i.map((P) => `&${(n == null ? void 0 : n.bPrefix) || m}${l.bem.b}${o !== void 0 ? `${u}${o}` : ""}${r}${P}`).join(", "); } const s = l.bem.els; if (s !== null) { if (process.env.NODE_ENV !== "production" && s.length >= 2) throw Error(`[css-render/plugin-bem]: m(${e}) is invalid, using modifier inside multiple elements is not allowed`); return t(s[0]); } else return t(); } }; } function E(e) { return { $({ context: l, props: n }) { e = typeof e == "string" ? e : e({ context: l, props: n }); const i = l.bem.els; if (process.env.NODE_ENV !== "production" && i !== null && i.length >= 2) throw Error(`[css-render/plugin-bem]: notM(${e}) is invalid, using modifier inside multiple elements is not allowed`); return `&:not(${(n == null ? void 0 : n.bPrefix) || m}${l.bem.b}${i !== null && i.length > 0 ? `${u}${i[0]}` : ""}${r}${e})`; } }; } return Object.assign(d, { cB: (...e) => b($(e[0]), e[1], e[2]), cE: (...e) => b(c(e[0]), e[1], e[2]), cM: (...e) => b(v(e[0]), e[1], e[2]), cNotM: (...e) => b(E(e[0]), e[1], e[2]) }), d; } export { w as p };