@tenoxui/moxie 0.1.0 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,25 +1,22 @@
1
- import type { Config, TenoxUIConfig, ProcessedStyle } from './types';
1
+ import type { Config, ProcessedStyle } from './types';
2
2
  export * from './types';
3
- export { Config, TenoxUIConfig };
4
3
  export declare class TenoxUI {
5
4
  private property;
6
5
  private values;
7
6
  private classes;
8
7
  private aliases;
9
- private breakpoints;
10
- constructor({ property, values, classes, aliases, breakpoints }?: Config);
8
+ constructor({ property, values, classes, aliases }?: Config);
11
9
  toKebabCase(str: string): string;
12
10
  escapeCSSSelector(str: string): string;
13
11
  private getAllClassNames;
14
12
  private getTypePrefixes;
15
13
  private generateClassNameRegEx;
16
- parseClassName(className: string): (string | undefined)[] | null;
17
- private generateMediaQuery;
18
- processValue(type: string, value?: string, unit?: string): string;
19
- processShorthand(type: string | undefined, value: string | undefined, unit: string | undefined, prefix: string | undefined, secondValue?: string | undefined, secondUnit?: string | undefined): ProcessedStyle | null;
14
+ parse(className: string, safelist?: string[]): (string | undefined)[] | null;
15
+ processValue(value: string, unit: string, group: string): string;
16
+ processShorthand(type: string | undefined, value: string | undefined, unit: string | undefined, prefix: string | undefined, secondValue?: string | undefined, secondUnit?: string | undefined, isHyphen?: boolean): ProcessedStyle | null;
20
17
  private parseValuePattern;
21
18
  private getParentClass;
22
- processCustomClass(className: string | undefined, value?: string | undefined, unit?: string | undefined, prefix?: string | undefined, secValue?: string | undefined, secUnit?: string | undefined): ProcessedStyle | null;
19
+ processCustomClass(className: string | undefined, value?: string | undefined, unit?: string | undefined, prefix?: string | undefined, secValue?: string | undefined, secUnit?: string | undefined, isHyphen?: boolean): ProcessedStyle | null;
23
20
  processAlias(className: string, prefix?: string): ProcessedStyle | null;
24
21
  process(classNames: string | string[]): ProcessedStyle[];
25
22
  }
package/dist/index.es.js CHANGED
@@ -1,327 +1,283 @@
1
- class Z {
2
- constructor({
3
- property: e = {},
4
- values: s = {},
5
- classes: t = {},
6
- aliases: a = {},
7
- breakpoints: r = []
8
- } = {}) {
9
- this.property = e, this.values = s, this.classes = t, this.aliases = a, this.breakpoints = r;
1
+ var j = Object.defineProperty;
2
+ var R = Object.getOwnPropertySymbols;
3
+ var z = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
4
+ var V = (P, s, e) => s in P ? j(P, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : P[s] = e, W = (P, s) => {
5
+ for (var e in s || (s = {}))
6
+ z.call(s, e) && V(P, e, s[e]);
7
+ if (R)
8
+ for (var e of R(s))
9
+ S.call(s, e) && V(P, e, s[e]);
10
+ return P;
11
+ };
12
+ class _ {
13
+ constructor({ property: s = {}, values: e = {}, classes: t = {}, aliases: n = {} } = {}) {
14
+ this.property = W({
15
+ moxie: ({ key: r }) => r
16
+ }, s), this.values = e, this.classes = t, this.aliases = n;
10
17
  }
11
- toKebabCase(e) {
12
- if (/^(webkit|moz|ms|o)[A-Z]/.test(e)) {
13
- const s = e.match(/^(webkit|moz|ms|o)/);
14
- if (s) {
15
- const t = s[0];
16
- return `-${t}${e.slice(t.length).replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`)}`;
18
+ toKebabCase(s) {
19
+ if (/^(webkit|moz|ms|o)[A-Z]/.test(s)) {
20
+ const e = s.match(/^(webkit|moz|ms|o)/);
21
+ if (e) {
22
+ const t = e[0];
23
+ return `-${t}${s.slice(t.length).replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`)}`;
17
24
  }
18
25
  }
19
- return e.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`);
26
+ return s.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
20
27
  }
21
- escapeCSSSelector(e) {
22
- return e.replace(/([ #{}.:;?%&,@+*~'"!^$[\]()=>|/])/g, "\\$1");
28
+ escapeCSSSelector(s) {
29
+ return s.replace(/([ #{}.:;?%&,@+*~'"!^$[\]()=>|/])/g, "\\$1");
23
30
  }
24
- getAllClassNames(e) {
25
- if (!e) return [];
26
- const s = /* @__PURE__ */ new Set();
27
- return Object.entries(e).forEach(([t, a]) => {
28
- a && typeof a == "object" && Object.keys(a).forEach((r) => {
29
- s.add(r);
31
+ getAllClassNames(s) {
32
+ if (!s) return [];
33
+ const e = /* @__PURE__ */ new Set();
34
+ return Object.entries(s).forEach(([t, n]) => {
35
+ n && typeof n == "object" && Object.keys(n).forEach((r) => {
36
+ e.add(r);
30
37
  });
31
- }), Array.from(s);
38
+ }), Array.from(e);
32
39
  }
33
- getTypePrefixes() {
34
- const e = this.property, s = this.classes, t = Object.keys(e);
35
- if (!s)
36
- return t.sort((l, i) => i.length - l.length).join("|");
37
- const r = [...this.getAllClassNames(s)];
38
- return [...t, ...r].sort((l, i) => i.length - l.length).join("|");
40
+ getTypePrefixes(s = []) {
41
+ const e = this.property, t = this.classes, n = Object.keys(e);
42
+ if (!t)
43
+ return [...n, ...s].sort((i, l) => l.length - i.length).join("|");
44
+ const c = [...this.getAllClassNames(t)];
45
+ return [...n, ...c, ...s].sort((i, l) => l.length - i.length).join("|");
39
46
  }
40
- generateClassNameRegEx() {
41
- const e = this.getTypePrefixes();
47
+ generateClassNameRegEx(s) {
48
+ const e = this.getTypePrefixes(s), t = "\\[[^\\]]+\\]", n = "\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)", r = "\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}", c = "(?:([a-zA-Z0-9_-]+|[a-zA-Z0-9_-]+(?:-" + t + ")|" + // Direct bracket, parenthesis, or brace content
49
+ t + "|" + n + "|" + r + "):)?", i = `(${e}|\\[[^\\]]+\\])`, l = "(?:-)?", h = "(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + // Hex colors
50
+ t + "|" + // Bracket content
51
+ r + "|" + // Curly brace content
52
+ n + "|(?:\\$[^\\s\\/]+))", f = "([a-zA-Z%]*)", a = "(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + t + "|" + r + "|" + n + "|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";
42
53
  return new RegExp(
43
- // you dont have to understand this, me neither
44
- `(?:([a-zA-Z0-9-]+|\\[[^\\]]+\\]|\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)|\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}):)?(${e}|\\[[^\\]]+\\])-(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|(?:\\[[^\\]]+\\])|(?:\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\})|(?:\\([^()]*(?:\\([^()]*\\)[^()]*)*\\))|(?:\\$[^\\s]+))([a-zA-Z%]*)(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|(?:\\[[^\\]]+\\])|(?:\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\})|(?:\\([^()]*(?:\\([^()]*\\)[^()]*)*\\))|(?:\\$[^\\s]+))([a-zA-Z%]*))?`
54
+ c + i + l + h + f + a
45
55
  );
46
56
  }
47
- parseClassName(e) {
48
- for (const [f, n] of Object.entries(this.classes))
49
- if (n && typeof n == "object" && e in n)
50
- return [void 0, e, "", "", void 0, void 0];
51
- const s = this.generateClassNameRegEx(), t = e.match(s);
52
- if (!t) return null;
53
- const [, a, r, l, i, u, o] = t;
54
- return [
55
- a,
56
- //? as its name. e.g. hover, md, focus
57
- r,
58
- //? compute css properties or variables that will styled. e.g. [color]-, [--red,background]-, bg-,
59
- l || "",
60
- //? parsed css value from the class name. e.g. red, space-between, 64, 100
61
- i || "",
62
- //? is optional if the value is numbers. e.g. px, rem, %
63
- // same as value and unit, parsed after the '/' character
64
- u,
65
- o
66
- ];
67
- }
68
- generateMediaQuery(e, s, t) {
69
- const { name: a, min: r, max: l } = e;
70
- let i = "screen and ";
71
- return r !== void 0 && l !== void 0 ? i += `(min-width: ${r}px) and (max-width: ${l}px)` : r !== void 0 ? i += `(min-width: ${r}px)` : l !== void 0 && (i += `(max-width: ${l}px)`), {
72
- mediaKey: `@media ${i}`,
73
- ruleSet: `.${a}\\:${s} { ${t} }`
74
- };
57
+ parse(s, e) {
58
+ if (Object.values(this.classes).some((p) => p == null ? void 0 : p[s]))
59
+ return [void 0, s, "", "", void 0, void 0];
60
+ const t = this.generateClassNameRegEx(e), n = (s + "-dummy").match(t);
61
+ if (!n) return null;
62
+ const [, r, c, i, l, h, f] = n, a = i === "dummy" ? "" : i.replace("-dummy", "");
63
+ return [r, c, a, l || "", h, f];
75
64
  }
76
65
  // unique value parser
77
- processValue(e, s, t) {
66
+ processValue(s, e, t) {
78
67
  if (!s) return "";
79
- const a = (r) => r.replace(/\{([^}]+)\}/g, (l, i) => {
80
- const u = typeof this.values == "object" && this.values !== null ? this.values[i] : void 0;
81
- return typeof u == "string" ? u : l;
68
+ const n = (r) => r.replace(/\{([^}]+)\}/g, (c, i) => {
69
+ const l = this.values, h = l !== null ? typeof l[t] == "object" ? l[t][i] : l[i] : void 0;
70
+ return typeof h == "string" ? h : c;
82
71
  });
83
- if (typeof this.values == "object" && this.values !== null && (this.values[e] && typeof this.values[e] == "object" && this.values[e][s] || this.values[s]))
84
- return typeof this.values[e] == "object" && this.values[e] !== null ? this.values[e][s] : this.values[s];
72
+ if (typeof this.values == "object" && this.values !== null && (this.values[t] && typeof this.values[t] == "object" && this.values[t][s] || this.values[s]))
73
+ return typeof this.values[t] == "object" && this.values[t] !== null ? this.values[t][s] : this.values[s];
85
74
  if (s.startsWith("$"))
86
75
  return `var(--${s.slice(1)})`;
87
76
  if (s.startsWith("[") && s.endsWith("]") || s.startsWith("(") && s.endsWith(")")) {
88
77
  const r = s.slice(1, -1).replace(/_/g, " ");
89
- return r.includes("{") ? a(r) : r.startsWith("--") ? `var(${r})` : r;
78
+ return r.includes("{") ? n(r) : r.startsWith("--") ? `var(${r})` : r;
90
79
  }
91
- return s + (t || "");
80
+ return s + (e || "");
92
81
  }
93
- processShorthand(e = "", s = "", t = "", a, r = "", l = "") {
94
- const i = this.property[e], u = /^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;
95
- let o = null, f = s || "";
96
- const n = f.match(u);
97
- n && (o = n[1].trim(), f = n[2].trim());
98
- let m;
99
- s.includes(o + ":") ? m = s.startsWith("(") ? `(${f})` : `[${f}]` : m = s;
100
- const h = this.processValue(e, m, t), $ = this.processValue(e, r, l);
101
- if (e.startsWith("[") && e.endsWith("]")) {
102
- const y = e.slice(1, -1).split(",").map((p) => p.trim()).map((p) => {
103
- const d = this.property[p] || p;
104
- return `${typeof d == "string" && d.startsWith("--") ? String(d) : this.toKebabCase(String(d))}: ${h}`;
82
+ processShorthand(s = "", e = "", t = "", n, r = "", c = "", i = !0) {
83
+ const l = this.property[s], h = /^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;
84
+ let f = null, a = e || "";
85
+ const p = a.match(h);
86
+ p && (f = p[1].trim(), a = p[2].trim());
87
+ let o;
88
+ e.includes(f + ":") ? o = e.startsWith("(") ? `(${a})` : `[${a}]` : o = e;
89
+ const u = this.processValue(o, t, s), m = this.processValue(r, c, s);
90
+ if (s.startsWith("[") && s.endsWith("]")) {
91
+ const d = s.slice(1, -1).split(",").map((y) => y.trim()).map((y) => {
92
+ const $ = this.property[y] || y;
93
+ return `${typeof $ == "string" && $.startsWith("--") ? String($) : this.toKebabCase(String($))}: ${u}`;
105
94
  }).join("; ");
106
95
  return {
107
- className: `${`[${e.slice(1, -1)}]-${s}${t}`}`,
108
- cssRules: y,
96
+ className: `${`[${s.slice(1, -1)}]${i ? "-" : ""}${e}${t}`}`,
97
+ cssRules: d,
109
98
  // return css rules directly
110
99
  value: null,
111
100
  // and set value to null to prevent value duplication
112
- prefix: a
101
+ prefix: n
113
102
  };
114
103
  }
115
- if (i) {
116
- if (typeof i == "object" && "property" in i && "value" in i) {
117
- const y = typeof i.property == "function" ? i.property({
118
- value: t ? s : h,
119
- unit: t,
120
- secondValue: l ? r : $,
121
- secondUnit: l,
122
- key: o
123
- }) : i.property, p = i.value;
124
- let d;
125
- typeof p == "function" ? d = p({
126
- value: t ? s : h,
104
+ if (l) {
105
+ if (typeof l == "object" && "property" in l && "value" in l) {
106
+ const d = typeof l.property == "function" ? l.property({
107
+ value: t ? e : u,
127
108
  unit: t,
128
- secondValue: l ? r : $,
129
- secondUnit: l,
130
- key: o,
131
- property: y
132
- }) : p && typeof p == "string" ? d = this.parseValuePattern(e, p, h, "", $, "") ? this.parseValuePattern(e, p, h, "", $, "") : h : d = null;
133
- const C = `${e}${s ? `-${s}${t}` : ""}${r ? `/${r}${l}` : ""}`;
109
+ secondValue: c ? r : m,
110
+ secondUnit: c,
111
+ key: f
112
+ }) : l.property, y = l.value;
113
+ let $;
114
+ if (typeof y == "function")
115
+ $ = y({
116
+ value: t ? e : u,
117
+ unit: t,
118
+ secondValue: c ? r : m,
119
+ secondUnit: c,
120
+ key: f,
121
+ property: d
122
+ });
123
+ else if (y && typeof y == "string") {
124
+ const C = l.group || s, A = this.processValue(o, t, C);
125
+ console.log(o), $ = this.values[o] || this.values[C][o] || o.includes("{") || y.includes("{") ? this.parseValuePattern(C, y, A, "", m, "") : u;
126
+ } else $ = null;
134
127
  return {
135
- className: i.classNameSuffix ? {
136
- className: C,
137
- modifier: i.classNameSuffix
138
- } : C,
139
- cssRules: Array.isArray(y) || typeof y == "string" && y.includes(":") ? y : this.toKebabCase(String(y)),
140
- value: p === null ? null : s.startsWith("[") ? h : d,
141
- prefix: a
128
+ className: `${s}${e ? `${i && i ? "-" : ""}${e}${t}` : ""}${r ? `/${r}${c}` : ""}`,
129
+ cssRules: Array.isArray(d) || typeof d == "string" && d.includes(":") ? d : this.toKebabCase(String(d)),
130
+ value: y === null ? null : e.startsWith("[") ? u : $,
131
+ prefix: n
142
132
  };
143
133
  }
144
- const c = typeof i == "function" ? i({
145
- value: t ? s : h,
134
+ const g = typeof l == "function" ? l({
135
+ value: t ? e : u,
146
136
  unit: t,
147
- secondValue: l ? r : $,
148
- secondUnit: l,
149
- key: o
150
- }) : i;
137
+ secondValue: c ? r : m,
138
+ secondUnit: c,
139
+ key: f
140
+ }) : l;
151
141
  return {
152
- className: `${e}${s ? "-" + s + t : ""}`,
153
- cssRules: Array.isArray(i) ? c : typeof c == "string" && c.startsWith("value:") ? c.slice(6) : this.toKebabCase(String(c)),
154
- value: typeof c == "string" && c.startsWith("value:") ? null : h,
155
- prefix: a
142
+ className: `${s}${e ? (i ? "-" : "") + e + t : ""}`,
143
+ cssRules: Array.isArray(l) ? g : typeof g == "string" && g.startsWith("value:") ? g.slice(6) : this.toKebabCase(String(g)),
144
+ value: typeof g == "string" && g.startsWith("value:") ? null : u,
145
+ prefix: n
156
146
  };
157
147
  }
158
148
  return null;
159
149
  }
160
- parseValuePattern(e, s, t, a, r, l) {
161
- if (!s.includes("{0}") && !s.includes("{1") && !s.includes("||"))
162
- return s;
163
- const [i, u] = s.split("||").map((n) => n.trim()), o = this.processValue(e, t, a), f = this.processValue(e, r, l);
164
- if (s.includes("{0}") && s.includes("{1") || s.includes("{1")) {
165
- let n = i;
166
- if (t && (n = n.replace("{0}", o)), s.includes("{1")) {
167
- const m = n.match(/{1([^}]*)}/);
168
- if (s.includes("{1}"))
169
- r ? n = r.startsWith("[") ? f : n.replace("{1}", f) : n = u;
170
- else if (m) {
171
- const h = m[0], $ = m[1].trim();
172
- let c = f;
173
- !c && $.includes("|") ? c = $.split("|")[1].trim() : c || (c = ""), n = t.startsWith("[") ? o : n.replace(h, c);
150
+ parseValuePattern(s, e, t, n, r, c) {
151
+ if (!e.includes("{0}") && !e.includes("{1") && !e.includes("||"))
152
+ return e;
153
+ const [i, l] = e.split("||").map((a) => a.trim()), h = this.processValue(t, n, s), f = this.processValue(r, c, s);
154
+ if (e.includes("{0}") && e.includes("{1") || e.includes("{1")) {
155
+ let a = i;
156
+ if (t && (a = a.replace("{0}", h)), e.includes("{1")) {
157
+ const p = a.match(/{1([^}]*)}/);
158
+ if (e.includes("{1}"))
159
+ r ? a = r.startsWith("[") ? f : a.replace("{1}", f) : a = l;
160
+ else if (p) {
161
+ const o = p[0], u = p[1].trim();
162
+ let m = f;
163
+ !m && u.includes("|") ? m = u.split("|")[1].trim() : m || (m = ""), a = t.startsWith("[") ? h : a.replace(o, m);
174
164
  }
175
165
  }
176
- return t ? n : u || i;
166
+ return t ? a : l || i;
177
167
  } else
178
- return t ? t.startsWith("[") ? o : i.replace("{0}", o) : u || i;
168
+ return t ? t.startsWith("[") ? h : i.replace("{0}", h) : l || i;
179
169
  }
180
- getParentClass(e) {
170
+ getParentClass(s) {
181
171
  return Object.keys(this.classes).filter(
182
- (s) => Object.prototype.hasOwnProperty.call(
183
- this.classes[s],
184
- e
172
+ (e) => Object.prototype.hasOwnProperty.call(
173
+ this.classes[e],
174
+ s
185
175
  )
186
176
  );
187
177
  }
188
- processCustomClass(e, s = "", t = "", a = "", r = "", l = "") {
189
- if (!e) return null;
190
- const i = this.getParentClass(e);
191
- if (i.length > 0) {
192
- const u = i.map((n) => {
193
- const m = this.classes[n];
194
- if (!m) return "";
195
- const h = this.parseValuePattern(
196
- e,
197
- m[e] || "",
178
+ processCustomClass(s, e = "", t = "", n = "", r = "", c = "", i = !0) {
179
+ if (!s) return null;
180
+ const l = this.getParentClass(s);
181
+ if (l.length > 0) {
182
+ const h = l.map((p) => {
183
+ const o = this.classes[p];
184
+ if (!o) return "";
185
+ const u = this.parseValuePattern(
198
186
  s,
187
+ o[s] || "",
188
+ e,
199
189
  t,
200
190
  r,
201
- l
191
+ c
202
192
  );
203
- return `${this.toKebabCase(String(n))}: ${h}`;
204
- }).filter(Boolean).join("; "), o = e.slice(-(s + t).length), f = `${e}${s ? `-${s}${t}` : ""}${r ? `/${r}${l}` : ""}`;
193
+ return `${this.toKebabCase(String(p))}: ${u}`;
194
+ }).filter(Boolean).join("; "), f = s.slice(-(e + t).length), a = `${s}${e ? `${i ? "-" : ""}${e}${t}` : ""}${r ? `/${r}${c}` : ""}`;
205
195
  return {
206
- className: this.escapeCSSSelector(s === o ? e : f),
207
- cssRules: u,
196
+ className: e === f ? s : a,
197
+ cssRules: h,
208
198
  value: null,
209
- prefix: a
199
+ prefix: n
210
200
  };
211
201
  }
212
202
  return null;
213
203
  }
214
- processAlias(e, s = "") {
215
- const t = this.aliases[e];
204
+ processAlias(s, e = "") {
205
+ const t = this.aliases[s];
216
206
  if (!t) return null;
217
- const a = t.split(" "), r = [];
218
- return a.forEach((l) => {
219
- const [i, u] = l.split(":"), o = u || i, f = u ? i : void 0, n = this.parseClassName(l), m = n || [f, o, "", ""];
220
- if (!m) return;
221
- const [h, $, c, y, p, d] = m, C = this.processShorthand($, c, y, void 0, p, d), S = this.processCustomClass($, c, y, h, p, d);
222
- if (S) {
223
- const { cssRules: A } = S;
224
- r.push(A);
207
+ const n = t.split(" "), r = [];
208
+ return n.forEach((c) => {
209
+ const [i, l] = c.split(":"), h = l || i, f = l ? i : void 0, a = this.parse(c), p = a || [f, h, "", ""];
210
+ if (!p) return;
211
+ const [o, u, m, g, d, y] = p, $ = this.processShorthand(u, m, g, void 0, d, y), x = this.processCustomClass(u, m, g, o, d, y);
212
+ if (x) {
213
+ const { cssRules: C } = x;
214
+ r.push(C);
225
215
  return;
226
216
  }
227
- if (C) {
228
- const A = C.value !== null ? `: ${C.value}` : "";
229
- Array.isArray(C.cssRules) ? C.cssRules.forEach((g) => {
230
- r.push(`${this.toKebabCase(g)}${A}`);
231
- }) : r.push(`${C.cssRules}${A}`);
217
+ if ($) {
218
+ const C = $.value !== null ? `: ${$.value}` : "";
219
+ Array.isArray($.cssRules) ? $.cssRules.forEach((A) => {
220
+ r.push(`${this.toKebabCase(A)}${C}`);
221
+ }) : r.push(`${$.cssRules}${C}`);
232
222
  }
233
223
  }), {
234
- className: e,
224
+ className: s,
235
225
  cssRules: r.join("; "),
236
226
  value: null,
237
- prefix: s
227
+ prefix: e
238
228
  };
239
229
  }
240
- process(e) {
241
- const s = Array.isArray(e) ? e : e.split(/\s+/), t = [];
242
- return s.forEach((a) => {
243
- if (!a) return this;
244
- const [r, l] = a.split(":"), i = l || r, u = l ? r : void 0, o = this.breakpoints.find((g) => g.name === u), f = this.processAlias(i, u);
245
- if (f) {
246
- const { className: g, cssRules: x } = f;
247
- if (o) {
248
- const { mediaKey: b, ruleSet: v } = this.generateMediaQuery(
249
- o,
250
- g,
251
- x
252
- );
253
- t.push({
254
- className: b,
255
- cssRules: v,
256
- value: null,
257
- prefix: null
258
- });
259
- } else
260
- t.push({
261
- className: g,
262
- cssRules: x,
263
- value: null,
264
- prefix: u
265
- });
230
+ process(s) {
231
+ const e = Array.isArray(s) ? s : s.split(/\s+/), t = [];
232
+ return e.forEach((n) => {
233
+ if (!n) return this;
234
+ const [r, c] = n.split(":"), i = c || r, l = c ? r : void 0, h = this.processAlias(i, l);
235
+ if (h) {
236
+ const { className: A, cssRules: b } = h;
237
+ t.push({
238
+ className: A,
239
+ cssRules: b,
240
+ value: null,
241
+ prefix: l
242
+ });
266
243
  return;
267
244
  }
268
- const n = this.parseClassName(a), m = n || [u, i, "", ""];
269
- if (!m) return this;
270
- const [h, $, c, y, p, d] = m, C = this.getParentClass(`${$}-${c}`).length > 0 ? `${$}-${c}` : $, S = this.processCustomClass(
271
- C,
272
- c,
273
- y,
274
- h,
245
+ const f = this.parse(n), a = f || [l, i, "", ""];
246
+ if (!a) return this;
247
+ const [p, o, u, m, g, d] = a, y = !n.includes((o || "") + (u || "")), $ = this.getParentClass(`${o}${y ? "-" : ""}${u}`).length > 0 ? `${o}${y ? "-" : ""}${u}` : o, x = this.processCustomClass(
248
+ $,
249
+ u,
250
+ m,
275
251
  p,
276
- d
252
+ g,
253
+ d,
254
+ y
277
255
  );
278
- if (S) {
279
- const { className: g, cssRules: x, prefix: b } = S;
280
- if (o) {
281
- const { mediaKey: v, ruleSet: R } = this.generateMediaQuery(
282
- o,
283
- g,
284
- x
285
- );
286
- t.push({
287
- className: v,
288
- cssRules: R,
289
- value: null,
290
- prefix: null
291
- });
292
- } else
293
- t.push({
294
- className: g,
295
- cssRules: x,
296
- value: null,
297
- prefix: b
298
- });
256
+ if (x) {
257
+ const { className: A, cssRules: b, prefix: v } = x;
258
+ t.push({
259
+ className: A,
260
+ cssRules: b,
261
+ value: null,
262
+ prefix: v
263
+ });
299
264
  return;
300
265
  }
301
- const A = this.processShorthand($, c, y, h, p, d);
302
- if (A) {
303
- const { className: g, cssRules: x, value: b, prefix: v } = A, R = typeof g == "string" ? this.escapeCSSSelector(g) : this.escapeCSSSelector(g.className) + g.modifier;
304
- if (o) {
305
- const j = Array.isArray(x) ? x.map((W) => `${this.toKebabCase(W)}: ${b}`).join("; ") : `${x}${b !== null ? `: ${b}` : ""}`, { mediaKey: P, ruleSet: V } = this.generateMediaQuery(o, R, j);
306
- t.push({
307
- className: P,
308
- cssRules: V,
309
- value: null,
310
- prefix: null
311
- });
312
- } else
313
- t.push({
314
- className: R,
315
- cssRules: x,
316
- value: b,
317
- prefix: v
318
- });
266
+ const C = this.processShorthand(o, u, m, p, g, d, y);
267
+ if (C) {
268
+ const { className: A, cssRules: b, value: v, prefix: Z } = C;
269
+ t.push({
270
+ className: A,
271
+ cssRules: b,
272
+ value: v,
273
+ prefix: Z
274
+ });
319
275
  }
320
276
  }), t;
321
277
  }
322
278
  }
323
279
  export {
324
- Z as TenoxUI,
325
- Z as default
280
+ _ as TenoxUI,
281
+ _ as default
326
282
  };
327
283
  //# sourceMappingURL=index.es.js.map