vue-uswds
Version:
Vue 3 implementation of the USWDS (U.S. Web Design System) component library
47 lines (46 loc) • 2.07 kB
JavaScript
import { getCurrentInstance as c } from "vue";
const v = "1.14.0";
var p = m, d = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/, g = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD][a-zà-ÿ]/g, l = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD]+/g;
function m(e) {
return e = e.replace(g, function(t) {
return " " + (t[0].toLowerCase() || t[0]) + t[1];
}), e = e.replace(l, function(t) {
return " " + t.toLowerCase();
}), e.trim().split(d).join("-").replace(/^-/, "").replace(/-\s*$/, "");
}
const r = (e) => p(e), P = ":", N = "grid-", E = "u-", f = "/assets/img", w = "/assets/img/sprite.svg", _ = null, A = "64em", C = "30em", I = "vuswds-id-", i = {};
function U(e = "") {
var n, a, u;
const t = c(), s = (u = (a = (n = t == null ? void 0 : t.appContext) == null ? void 0 : n.config) == null ? void 0 : a.globalProperties) == null ? void 0 : u.$route, o = s != null && s.path && r(s.path) ? r(s.path) : "global";
return i[o] || (i[o] = 0), `${I}${o}-${r(e)}-${++i[o]}`;
}
const B = {
install: (e, t) => {
const o = {
prefixSeparator: P,
gridNamespace: N,
utilityNamespace: E,
imagePath: f,
svgSpritePath: w,
routerComponentName: _,
mobileMenuBreakpoint: A,
footerNavBigBreakpoint: C,
...t ?? {},
version: v
};
e.config.globalProperties.$vueUswds || (e.config.globalProperties.$vueUswds = o), e.provide("vueUswds.prefixSeparator", o.prefixSeparator), e.provide("vueUswds.gridNamespace", o.gridNamespace), e.provide("vueUswds.utilityNamespace", o.utilityNamespace), e.provide("vueUswds.imagePath", o.imagePath), e.provide("vueUswds.svgSpritePath", o.svgSpritePath), e.provide(
"vueUswds.routerComponentName",
o.routerComponentName
), e.provide(
"vueUswds.mobileMenuBreakpoint",
o.mobileMenuBreakpoint
), e.provide(
"vueUswds.footerNavBigBreakpoint",
o.footerNavBigBreakpoint
), e.provide("vueUswds.version", o.version), e.provide("nextId", U);
}
};
export {
B as default
};
//# sourceMappingURL=vue-uswds.core.es.js.map