ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
42 lines (41 loc) • 1.09 kB
JavaScript
import { ref as d, getCurrentInstance as v, inject as g, computed as s, provide as b, unref as C } from "vue";
const a = "globalProvider", c = d({});
let p = {};
const f = (e) => Object.keys(e);
function y(e, o = void 0) {
const l = v() ? g(a, c) : c;
return e ? s(() => {
var n;
return ((n = l.value) == null ? void 0 : n[e]) ?? o;
}) : l;
}
function G(e, o) {
const l = [.../* @__PURE__ */ new Set([...f(e), ...f(o)])], n = {};
for (const t of l)
n[t] = o[t] ?? e[t];
return n;
}
function j(e, o, l = !1) {
const n = !!v(), t = n ? y() : void 0;
p = e;
const i = (o == null ? void 0 : o.provide) ?? (n ? b : void 0);
if (!i)
return;
const r = s(() => {
const u = C(e);
return t != null && t.value ? G(t.value, u) : u;
});
return i(a, r), i(
"locale",
s(() => r.value.locale)
), i("size", {
size: s(() => r.value.size || "")
}), (l || !c.value) && (c.value = r.value), r;
}
export {
f as keysOf,
j as provideGlobalConfig,
y as useGlobalConfig,
p as vue2GlobalConfig
};
//# sourceMappingURL=useGlobalConfig.mjs.map