@uoguelph/web-components 2.0.6 → 2.0.8-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,139 @@
1
+ import { aK as ne, aL as oe } from "./index-CEFM1xyC.js";
2
+ var H = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, d = (e) => !e || typeof e != "object" || Object.keys(e).length === 0, ie = (e, f) => JSON.stringify(e) === JSON.stringify(f);
3
+ function U(e, f) {
4
+ e.forEach(function(r) {
5
+ Array.isArray(r) ? U(r, f) : f.push(r);
6
+ });
7
+ }
8
+ function W(e) {
9
+ let f = [];
10
+ return U(e, f), f;
11
+ }
12
+ var _ = (...e) => W(e).filter(Boolean), $ = (e, f) => {
13
+ let r = {}, V = Object.keys(e), k = Object.keys(f);
14
+ for (let y of V) if (k.includes(y)) {
15
+ let g = e[y], h = f[y];
16
+ Array.isArray(g) || Array.isArray(h) ? r[y] = _(h, g) : typeof g == "object" && typeof h == "object" ? r[y] = $(g, h) : r[y] = h + " " + g;
17
+ } else r[y] = e[y];
18
+ for (let y of k) V.includes(y) || (r[y] = f[y]);
19
+ return r;
20
+ }, I = (e) => !e || typeof e != "string" ? e : e.replace(/\s+/g, " ").trim(), se = { twMerge: !0, twMergeConfig: {}, responsiveVariants: !1 }, F = (e) => e || void 0, x = (...e) => F(W(e).filter(Boolean).join(" ")), P = null, A = {}, R = !1, C = (...e) => (f) => f.twMerge ? ((!P || R) && (R = !1, P = d(A) ? ne : oe({ ...A, extend: { theme: A.theme, classGroups: A.classGroups, conflictingClassGroupModifiers: A.conflictingClassGroupModifiers, conflictingClassGroups: A.conflictingClassGroups, ...A.extend } })), F(P(x(e)))) : x(e), Q = (e, f) => {
21
+ for (let r in f) e.hasOwnProperty(r) ? e[r] = x(e[r], f[r]) : e[r] = f[r];
22
+ return e;
23
+ }, fe = (e, f) => {
24
+ let { extend: r = null, slots: V = {}, variants: k = {}, compoundVariants: y = [], compoundSlots: g = [], defaultVariants: h = {} } = e, v = { ...se, ...f }, T = r != null && r.base ? x(r.base, e == null ? void 0 : e.base) : e == null ? void 0 : e.base, b = r != null && r.variants && !d(r.variants) ? $(k, r.variants) : k, N = r != null && r.defaultVariants && !d(r.defaultVariants) ? { ...r.defaultVariants, ...h } : h;
25
+ !d(v.twMergeConfig) && !ie(v.twMergeConfig, A) && (R = !0, A = v.twMergeConfig);
26
+ let G = d(r == null ? void 0 : r.slots), E = d(V) ? {} : { base: x(e == null ? void 0 : e.base, G && (r == null ? void 0 : r.base)), ...V }, M = G ? E : Q({ ...r == null ? void 0 : r.slots }, d(E) ? { base: e == null ? void 0 : e.base } : E), w = d(r == null ? void 0 : r.compoundVariants) ? y : _(r == null ? void 0 : r.compoundVariants, y), m = (c) => {
27
+ if (d(b) && d(V) && G) return C(T, c == null ? void 0 : c.class, c == null ? void 0 : c.className)(v);
28
+ if (w && !Array.isArray(w)) throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof w}`);
29
+ if (g && !Array.isArray(g)) throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof g}`);
30
+ let Y = (t, n, l = [], i) => {
31
+ let o = l;
32
+ if (typeof n == "string") o = o.concat(I(n).split(" ").map((s) => `${t}:${s}`));
33
+ else if (Array.isArray(n)) o = o.concat(n.reduce((s, a) => s.concat(`${t}:${a}`), []));
34
+ else if (typeof n == "object" && typeof i == "string") {
35
+ for (let s in n) if (n.hasOwnProperty(s) && s === i) {
36
+ let a = n[s];
37
+ if (a && typeof a == "string") {
38
+ let u = I(a);
39
+ o[i] ? o[i] = o[i].concat(u.split(" ").map((p) => `${t}:${p}`)) : o[i] = u.split(" ").map((p) => `${t}:${p}`);
40
+ } else Array.isArray(a) && a.length > 0 && (o[i] = a.reduce((u, p) => u.concat(`${t}:${p}`), []));
41
+ }
42
+ }
43
+ return o;
44
+ }, B = (t, n = b, l = null, i = null) => {
45
+ var o;
46
+ let s = n[t];
47
+ if (!s || d(s)) return null;
48
+ let a = (o = i == null ? void 0 : i[t]) != null ? o : c == null ? void 0 : c[t];
49
+ if (a === null) return null;
50
+ let u = H(a), p = Array.isArray(v.responsiveVariants) && v.responsiveVariants.length > 0 || v.responsiveVariants === !0, O = N == null ? void 0 : N[t], j = [];
51
+ if (typeof u == "object" && p) for (let [K, D] of Object.entries(u)) {
52
+ let le = s[D];
53
+ if (K === "initial") {
54
+ O = D;
55
+ continue;
56
+ }
57
+ Array.isArray(v.responsiveVariants) && !v.responsiveVariants.includes(K) || (j = Y(K, le, j, l));
58
+ }
59
+ let S = u != null && typeof u != "object" ? u : H(O), J = s[S || "false"];
60
+ return typeof j == "object" && typeof l == "string" && j[l] ? Q(j, J) : j.length > 0 ? (j.push(J), l === "base" ? j.join(" ") : j) : J;
61
+ }, Z = () => b ? Object.keys(b).map((t) => B(t, b)) : null, ee = (t, n) => {
62
+ if (!b || typeof b != "object") return null;
63
+ let l = new Array();
64
+ for (let i in b) {
65
+ let o = B(i, b, t, n), s = t === "base" && typeof o == "string" ? o : o && o[t];
66
+ s && (l[l.length] = s);
67
+ }
68
+ return l;
69
+ }, L = {};
70
+ for (let t in c) c[t] !== void 0 && (L[t] = c[t]);
71
+ let q = (t, n) => {
72
+ var l;
73
+ let i = typeof (c == null ? void 0 : c[t]) == "object" ? { [t]: (l = c[t]) == null ? void 0 : l.initial } : {};
74
+ return { ...N, ...L, ...i, ...n };
75
+ }, z = (t = [], n) => {
76
+ let l = [];
77
+ for (let { class: i, className: o, ...s } of t) {
78
+ let a = !0;
79
+ for (let [u, p] of Object.entries(s)) {
80
+ let O = q(u, n)[u];
81
+ if (Array.isArray(p)) {
82
+ if (!p.includes(O)) {
83
+ a = !1;
84
+ break;
85
+ }
86
+ } else {
87
+ let j = (S) => S == null || S === !1;
88
+ if (j(p) && j(O)) continue;
89
+ if (O !== p) {
90
+ a = !1;
91
+ break;
92
+ }
93
+ }
94
+ }
95
+ a && (i && l.push(i), o && l.push(o));
96
+ }
97
+ return l;
98
+ }, re = (t) => {
99
+ let n = z(w, t);
100
+ if (!Array.isArray(n)) return n;
101
+ let l = {};
102
+ for (let i of n) if (typeof i == "string" && (l.base = C(l.base, i)(v)), typeof i == "object") for (let [o, s] of Object.entries(i)) l[o] = C(l[o], s)(v);
103
+ return l;
104
+ }, te = (t) => {
105
+ if (g.length < 1) return null;
106
+ let n = {};
107
+ for (let { slots: l = [], class: i, className: o, ...s } of g) {
108
+ if (!d(s)) {
109
+ let a = !0;
110
+ for (let u of Object.keys(s)) {
111
+ let p = q(u, t)[u];
112
+ if (p === void 0 || (Array.isArray(s[u]) ? !s[u].includes(p) : s[u] !== p)) {
113
+ a = !1;
114
+ break;
115
+ }
116
+ }
117
+ if (!a) continue;
118
+ }
119
+ for (let a of l) n[a] = n[a] || [], n[a].push([i, o]);
120
+ }
121
+ return n;
122
+ };
123
+ if (!d(V) || !G) {
124
+ let t = {};
125
+ if (typeof M == "object" && !d(M)) for (let n of Object.keys(M)) t[n] = (l) => {
126
+ var i, o;
127
+ return C(M[n], ee(n, l), ((i = re(l)) != null ? i : [])[n], ((o = te(l)) != null ? o : [])[n], l == null ? void 0 : l.class, l == null ? void 0 : l.className)(v);
128
+ };
129
+ return t;
130
+ }
131
+ return C(T, Z(), z(w), c == null ? void 0 : c.class, c == null ? void 0 : c.className)(v);
132
+ }, X = () => {
133
+ if (!(!b || typeof b != "object")) return Object.keys(b);
134
+ };
135
+ return m.variantKeys = X(), m.extend = r, m.base = T, m.slots = M, m.variants = b, m.defaultVariants = N, m.compoundSlots = g, m.compoundVariants = w, m;
136
+ };
137
+ export {
138
+ fe as c
139
+ };