@tenoxui/moxie 0.3.2 → 0.4.0-alpha.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
@@ -4,8 +4,7 @@ export declare class TenoxUI {
4
4
  private property;
5
5
  private values;
6
6
  private classes;
7
- private aliases;
8
- constructor({ property, values, classes, aliases }?: Config);
7
+ constructor({ property, values, classes }?: Config);
9
8
  toKebabCase(str: string): string;
10
9
  escapeCSSSelector(str: string): string;
11
10
  private getAllClassNames;
@@ -17,7 +16,6 @@ export declare class TenoxUI {
17
16
  private parseValuePattern;
18
17
  private getParentClass;
19
18
  processCustomClass(className: string | undefined, value?: string | undefined, unit?: string | undefined, prefix?: string | undefined, secValue?: string | undefined, secUnit?: string | undefined, isHyphen?: boolean): ProcessedStyle | null;
20
- processAlias(className: string, prefix?: string): ProcessedStyle | null;
21
19
  process(classNames: string | string[]): ProcessedStyle[];
22
20
  }
23
21
  export default TenoxUI;
package/dist/index.es.js CHANGED
@@ -1,372 +1,249 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
1
+ var S = Object.defineProperty;
2
+ var x = Object.getOwnPropertySymbols;
3
+ var Z = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
4
+ var V = (P, s, t) => s in P ? S(P, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : P[s] = t, v = (P, s) => {
5
+ for (var t in s || (s = {}))
6
+ Z.call(s, t) && V(P, t, s[t]);
7
+ if (x)
8
+ for (var t of x(s))
9
+ j.call(s, t) && V(P, t, s[t]);
10
+ return P;
16
11
  };
17
- class TenoxUI {
18
- constructor({ property = {}, values = {}, classes = {}, aliases = {} } = {}) {
19
- this.property = __spreadValues({
20
- moxie: ({ key }) => key
21
- }, property);
22
- this.values = values;
23
- this.classes = classes;
24
- this.aliases = aliases;
12
+ class _ {
13
+ constructor({ property: s = {}, values: t = {}, classes: e = {} } = {}) {
14
+ this.property = v({
15
+ moxie: ({ key: n }) => n
16
+ }, s), this.values = t, this.classes = e;
25
17
  }
26
- toKebabCase(str) {
27
- if (/^(webkit|moz|ms|o)[A-Z]/.test(str)) {
28
- const match = str.match(/^(webkit|moz|ms|o)/);
29
- if (match) {
30
- const prefix = match[0];
31
- return `-${prefix}${str.slice(prefix.length).replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;
18
+ toKebabCase(s) {
19
+ if (/^(webkit|moz|ms|o)[A-Z]/.test(s)) {
20
+ const t = s.match(/^(webkit|moz|ms|o)/);
21
+ if (t) {
22
+ const e = t[0];
23
+ return `-${e}${s.slice(e.length).replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`)}`;
32
24
  }
33
25
  }
34
- return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
26
+ return s.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
35
27
  }
36
- escapeCSSSelector(str) {
37
- return str.replace(/([ #{}.:;?%&,@+*~'"!^$[\]()=>|/])/g, "\\$1");
28
+ escapeCSSSelector(s) {
29
+ return s.replace(/([ #{}.:;?%&,@+*~'"!^$[\]()=>|/])/g, "\\$1");
38
30
  }
39
- getAllClassNames(classRegistry) {
40
- if (!classRegistry) return [];
41
- const classNames = /* @__PURE__ */ new Set();
42
- Object.entries(classRegistry).forEach(([property, classObj]) => {
43
- if (classObj && typeof classObj === "object") {
44
- Object.keys(classObj).forEach((className) => {
45
- classNames.add(className);
46
- });
47
- }
48
- });
49
- return Array.from(classNames);
31
+ getAllClassNames(s) {
32
+ if (!s) return [];
33
+ const t = /* @__PURE__ */ new Set();
34
+ return Object.entries(s).forEach(([e, n]) => {
35
+ n && typeof n == "object" && Object.keys(n).forEach((r) => {
36
+ t.add(r);
37
+ });
38
+ }), Array.from(t);
50
39
  }
51
- getTypePrefixes(safelist = []) {
52
- const styleAttribute = this.property;
53
- const classRegistry = this.classes;
54
- const propertyTypes = Object.keys(styleAttribute);
55
- if (!classRegistry) {
56
- return [...propertyTypes, ...safelist].sort((a, b) => b.length - a.length).join("|");
57
- }
58
- const classConfigs = this.getAllClassNames(classRegistry);
59
- const classPatterns = [...classConfigs];
60
- return [...propertyTypes, ...classPatterns, ...safelist].sort((a, b) => b.length - a.length).join("|");
40
+ getTypePrefixes(s = []) {
41
+ const t = this.property, e = this.classes, n = Object.keys(t);
42
+ if (!e)
43
+ return [...n, ...s].sort((l, i) => i.length - l.length).join("|");
44
+ const a = [...this.getAllClassNames(e)];
45
+ return [...n, ...a, ...s].sort((l, i) => i.length - l.length).join("|");
61
46
  }
62
- generateClassNameRegEx(safelist) {
63
- const typePrefixes = this.getTypePrefixes(safelist);
64
- const nestedBracketPattern = "\\[[^\\]]+\\]";
65
- const nestedParenPattern = "\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)";
66
- const nestedBracePattern = "\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}";
67
- const prefixPattern = "(?:([a-zA-Z0-9_-]+|[a-zA-Z0-9_-]+(?:-" + nestedBracketPattern + ")|" + // Direct bracket, parenthesis, or brace content
68
- nestedBracketPattern + "|" + nestedParenPattern + "|" + nestedBracePattern + "):)?";
69
- const typePattern = `(${typePrefixes}|\\[[^\\]]+\\])`;
70
- const separator = "(?:-)?";
71
- const valuePattern = "(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + // Hex colors
72
- nestedBracketPattern + "|" + // Bracket content
73
- nestedBracePattern + "|" + // Curly brace content
74
- nestedParenPattern + "|(?:\\$[^\\s\\/]+))";
75
- const unitPattern = "([a-zA-Z%]*)";
76
- const secondaryPattern = "(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + nestedBracketPattern + "|" + nestedBracePattern + "|" + nestedParenPattern + "|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";
47
+ generateClassNameRegEx(s) {
48
+ const t = this.getTypePrefixes(s), e = "\\[[^\\]]+\\]", n = "\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)", r = "\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}", a = "(?:([a-zA-Z0-9_-]+|[a-zA-Z0-9_-]+(?:-(?:" + e + "|" + n + "|" + r + "))|" + // Direct bracket, parenthesis, or brace content
49
+ e + "|" + n + "|" + r + "):)?", l = `(${t}|\\[[^\\]]+\\])`, i = "(?:-)?", u = "(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + // Hex colors
50
+ e + "|" + // Bracket content
51
+ r + "|" + // Curly brace content
52
+ n + "|(?:\\$[^\\s\\/]+))", h = "([a-zA-Z%]*)", c = "(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + e + "|" + r + "|" + n + "|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";
77
53
  return new RegExp(
78
- prefixPattern + typePattern + separator + valuePattern + unitPattern + secondaryPattern
54
+ a + l + i + u + h + c
79
55
  );
80
56
  }
81
- parse(className, safelist) {
82
- if (Object.values(this.classes).some((classObj) => classObj == null ? void 0 : classObj[className])) {
83
- return [void 0, className, "", "", void 0, void 0];
84
- }
85
- const classNameRegEx = this.generateClassNameRegEx(safelist);
86
- const match = (className + "-dummy").match(classNameRegEx);
87
- if (!match) return null;
88
- const [, prefix, type, value, unit, secValue, secUnit] = match;
89
- const finalValue = value === "dummy" ? "" : value.replace("-dummy", "");
90
- return [prefix, type, finalValue, unit || "", secValue, secUnit];
57
+ parse(s, t) {
58
+ if (Object.values(this.classes).some((o) => o == null ? void 0 : o[s]))
59
+ return [void 0, s, "", "", void 0, void 0];
60
+ const e = this.generateClassNameRegEx(t), n = (s + "-dummy").match(e);
61
+ if (!n) return null;
62
+ const [, r, a, l, i, u, h] = n, c = l ? l === "dummy" ? "" : l.replace("-dummy", "") : "", f = u ? u === "dummy" ? "" : u.replace("-dummy", "") : "";
63
+ return [r, a, c, i || "", f, h];
91
64
  }
92
65
  // unique value parser
93
- processValue(value, unit, group) {
94
- if (!value) return "";
95
- const replaceWithValueRegistry = (text) => {
96
- return text.replace(/\{([^}]+)\}/g, (match, key) => {
97
- const valueRegistry = this.values;
98
- const val = valueRegistry !== null ? typeof valueRegistry[group] === "object" ? valueRegistry[group][key] : valueRegistry[key] : void 0;
99
- return typeof val === "string" ? val : match;
100
- });
101
- };
102
- if (typeof this.values === "object" && this.values !== null && (this.values[group] && typeof this.values[group] === "object" && this.values[group][value] || this.values[value])) {
103
- if (typeof this.values[group] === "object" && this.values[group] !== null) {
104
- return this.values[group][value];
105
- }
106
- return this.values[value];
107
- } else if (value.startsWith("$")) {
108
- return `var(--${value.slice(1)})`;
109
- } else if (value.startsWith("[") && value.endsWith("]") || value.startsWith("(") && value.endsWith(")")) {
110
- const cleanValue = value.slice(1, -1).replace(/_/g, " ");
111
- if (cleanValue.includes("{")) {
112
- return replaceWithValueRegistry(cleanValue);
113
- }
114
- return cleanValue.startsWith("--") ? `var(${cleanValue})` : cleanValue;
66
+ processValue(s, t, e) {
67
+ if (!s) return "";
68
+ const n = (r) => r.replace(/\{([^}]+)\}/g, (a, l) => {
69
+ const i = this.values, u = i !== null ? typeof i[e] == "object" ? i[e][l] : i[l] : void 0;
70
+ return typeof u == "string" ? u : a;
71
+ });
72
+ if (typeof this.values == "object" && this.values !== null && (this.values[e] && typeof this.values[e] == "object" && this.values[e][s] || this.values[s]))
73
+ return typeof this.values[e] == "object" && this.values[e] !== null ? this.values[e][s] : this.values[s];
74
+ if (s.startsWith("$"))
75
+ return `var(--${s.slice(1)})`;
76
+ if (s.startsWith("[") && s.endsWith("]") || s.startsWith("(") && s.endsWith(")")) {
77
+ const r = s.slice(1, -1).replace(/_/g, " ");
78
+ return r.includes("{") ? n(r) : r.startsWith("--") ? `var(${r})` : r;
115
79
  }
116
- return value + (unit || "");
80
+ return s + (t || "");
117
81
  }
118
- processShorthand(type = "", value = "", unit = "", prefix, secondValue = "", secondUnit = "", isHyphen = true) {
119
- const properties = this.property[type];
120
- const pattern = /^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;
121
- let extractedFor = null;
122
- let cleanValue = value || "";
123
- const matchValue = cleanValue.match(pattern);
124
- if (matchValue) {
125
- extractedFor = matchValue[1].trim();
126
- cleanValue = matchValue[2].trim();
127
- }
128
- let finalCleanValue;
129
- if (value.includes(extractedFor + ":")) {
130
- finalCleanValue = value.startsWith("(") ? `(${cleanValue})` : `[${cleanValue}]`;
131
- } else finalCleanValue = value;
132
- const finalValue = this.processValue(finalCleanValue, unit, type);
133
- const finalSecValue = this.processValue(secondValue, secondUnit, type);
134
- if (type.startsWith("[") && type.endsWith("]")) {
135
- const items = type.slice(1, -1).split(",").map((item) => item.trim());
136
- const cssRules = items.map((item) => {
137
- const prop = this.property[item] || item;
138
- const finalProperty = typeof prop === "string" && prop.startsWith("--") ? String(prop) : this.toKebabCase(String(prop));
139
- return `${finalProperty}: ${finalValue}`;
140
- }).join("; ");
82
+ processShorthand(s = "", t = "", e = "", n, r = "", a = "", l = !0) {
83
+ const i = this.property[s], u = /^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;
84
+ let h = null, c = t || "";
85
+ const f = c.match(u);
86
+ f && (h = f[1].trim(), c = f[2].trim());
87
+ let o;
88
+ t.includes(h + ":") ? o = t.startsWith("(") ? `(${c})` : `[${c}]` : o = t;
89
+ const p = this.processValue(o, e, s), y = this.processValue(r, a, s);
90
+ if (s.startsWith("[") && s.endsWith("]")) {
91
+ const C = s.slice(1, -1).split(",").map(($) => $.trim()).map(($) => `${$.startsWith("--") ? String($) : this.toKebabCase(String($))}: ${p}`).join("; ");
141
92
  return {
142
- className: `${`[${type.slice(1, -1)}]${isHyphen ? "-" : ""}${value}${unit}`}`,
143
- cssRules,
93
+ className: `${`[${s.slice(1, -1)}]${l ? "-" : ""}${t}${e}`}`,
94
+ cssRules: C,
144
95
  // return css rules directly
145
96
  value: null,
146
97
  // and set value to null to prevent value duplication
147
- prefix
98
+ prefix: n
148
99
  };
149
100
  }
150
- if (properties) {
151
- if (typeof properties === "object" && "property" in properties && "value" in properties) {
152
- const groupValue = properties.group && this.values[properties.group] ? this.values[properties.group][finalValue] : unit ? value : finalValue;
153
- const property = typeof properties.property === "function" ? properties.property({
154
- value: groupValue,
155
- unit,
156
- secondValue: secondUnit ? secondValue : finalSecValue,
157
- secondUnit,
158
- key: extractedFor
159
- }) : properties.property;
160
- const template = properties.value;
161
- let processedValue;
162
- if (typeof template === "function") {
163
- processedValue = template({
164
- value: groupValue,
165
- unit,
166
- secondValue: secondUnit ? secondValue : finalSecValue,
167
- secondUnit,
168
- key: extractedFor,
169
- property
101
+ if (i) {
102
+ if (typeof i == "object" && "property" in i) {
103
+ const C = i.group && this.values[i.group][p] ? this.values[i.group][p] : e ? t : p, $ = typeof i.property == "function" ? i.property({
104
+ value: t.startsWith("[") ? p : C,
105
+ unit: t.startsWith("[") ? "" : e,
106
+ secondValue: t.startsWith("[") ? "" : a ? r : y,
107
+ secondUnit: t.startsWith("[") ? "" : a,
108
+ key: h
109
+ }) : i.property, g = i.value || "{0}";
110
+ let A;
111
+ if (typeof g == "function")
112
+ A = g({
113
+ value: C,
114
+ unit: e,
115
+ secondValue: a ? r : y,
116
+ secondUnit: a,
117
+ key: h
170
118
  });
171
- } else if (template && typeof template === "string") {
172
- const valuesGroup = properties.group || type;
173
- const newValue = this.processValue(finalCleanValue, unit, valuesGroup);
174
- processedValue = this.values[finalCleanValue] || this.values[valuesGroup][finalCleanValue] || finalCleanValue.includes("{") || template.includes("{") ? this.parseValuePattern(valuesGroup, template, newValue, "", finalSecValue, "") : finalValue;
175
- } else processedValue = null;
176
- const className = `${type}${value ? `${isHyphen ? isHyphen ? "-" : "" : ""}${value}${unit}` : ""}${secondValue ? `/${secondValue}${secondUnit}` : ""}`;
119
+ else if (typeof g == "string") {
120
+ const d = i.group || s, W = this.processValue(o, e, d);
121
+ this.values[d] && typeof this.values[d] == "object" && this.values[d][o] ? A = this.values[d][o] : g.includes("{") ? A = this.parseValuePattern(
122
+ d,
123
+ g,
124
+ W,
125
+ "",
126
+ y,
127
+ ""
128
+ ) : A = p;
129
+ } else A = null;
177
130
  return {
178
- className,
179
- cssRules: Array.isArray(property) ? property : typeof property === "string" && property.includes(":") ? property : this.toKebabCase(String(property)),
180
- value: template === null ? null : value.startsWith("[") ? finalValue : processedValue,
181
- prefix
131
+ className: `${s}${t ? `${l && l ? "-" : ""}${t}${e}` : ""}${r ? `/${r}${a}` : ""}`,
132
+ cssRules: Array.isArray($) ? $ : typeof $ == "string" && ($.includes(":") || $.includes("value:")) ? $.includes("value:") ? $.slice(6) : this.toKebabCase(String($)) : this.toKebabCase(String($)),
133
+ value: g === null || $.includes("value:") ? null : t.startsWith("[") ? p : A,
134
+ prefix: n
182
135
  };
183
136
  }
184
- const finalRegProperty = typeof properties === "function" ? properties({
185
- value: unit ? value : finalValue,
186
- unit,
187
- secondValue: secondUnit ? secondValue : finalSecValue,
188
- secondUnit,
189
- key: extractedFor
190
- }) : properties;
137
+ const m = typeof i == "function" ? i({
138
+ value: t.startsWith("[") ? p : e ? t : p,
139
+ unit: t.startsWith("[") ? "" : e,
140
+ secondValue: t.startsWith("[") ? "" : a ? r : y,
141
+ secondUnit: t.startsWith("[") ? "" : a,
142
+ key: h
143
+ }) : i;
191
144
  return {
192
- className: `${type}${value ? (isHyphen ? "-" : "") + value + unit : ""}`,
193
- cssRules: Array.isArray(properties) ? finalRegProperty : typeof finalRegProperty === "string" && finalRegProperty.startsWith("value:") ? finalRegProperty.slice(6) : this.toKebabCase(String(finalRegProperty)),
194
- value: typeof finalRegProperty === "string" && finalRegProperty.startsWith("value:") ? null : finalValue,
195
- prefix
145
+ className: `${s}${t ? (l ? "-" : "") + t + e : ""}${r ? `/${r}${a}` : ""}`,
146
+ cssRules: Array.isArray(i) ? m : typeof m == "string" && m.startsWith("value:") ? m.slice(6) : this.toKebabCase(String(m)),
147
+ value: typeof m == "string" && m.startsWith("value:") ? null : p,
148
+ prefix: n
196
149
  };
197
150
  }
198
151
  return null;
199
152
  }
200
- parseValuePattern(group, pattern, inputValue, inputUnit, inputSecValue, inputSecUnit) {
201
- if (!pattern.includes("{0}") && !pattern.includes("{1") && !pattern.includes("||"))
202
- return pattern;
203
- const [value, defaultValue] = pattern.split("||").map((s) => s.trim());
204
- const finalValue = this.processValue(inputValue, inputUnit, group);
205
- const finalSecValue = this.processValue(inputSecValue, inputSecUnit, group);
206
- if (pattern.includes("{0}") && pattern.includes("{1") || pattern.includes("{1")) {
207
- let computedValue = value;
208
- if (inputValue) {
209
- computedValue = computedValue.replace("{0}", finalValue);
210
- }
211
- if (pattern.includes("{1")) {
212
- const match = computedValue.match(/{1([^}]*)}/);
213
- if (pattern.includes("{1}")) {
214
- if (inputSecValue) {
215
- computedValue = inputSecValue.startsWith("[") ? finalSecValue : computedValue.replace("{1}", finalSecValue);
216
- } else {
217
- computedValue = defaultValue;
218
- }
219
- } else if (match) {
220
- const fullMatch = match[0];
221
- const innerContent = match[1].trim();
222
- let replacementValue = finalSecValue;
223
- if (!replacementValue && innerContent.includes("|")) {
224
- replacementValue = innerContent.split("|")[1].trim();
225
- } else if (!replacementValue) {
226
- replacementValue = "";
227
- }
228
- computedValue = inputValue.startsWith("[") ? finalValue : computedValue.replace(fullMatch, replacementValue);
153
+ parseValuePattern(s, t, e, n, r, a) {
154
+ if (!t.includes("{0}") && !t.includes("{1") && !t.includes("||"))
155
+ return t;
156
+ const [l, i] = t.split("||").map((c) => c.trim()), u = this.processValue(e, n, s), h = this.processValue(r, a, s);
157
+ if (t.includes("{0}") && t.includes("{1") || t.includes("{1")) {
158
+ let c = l;
159
+ if (e && (c = c.replace("{0}", u)), t.includes("{1")) {
160
+ const f = c.match(/{1([^}]*)}/);
161
+ if (t.includes("{1}"))
162
+ r ? c = r.startsWith("[") ? h : c.replace("{1}", h) : c = i;
163
+ else if (f) {
164
+ const o = f[0], p = f[1].trim();
165
+ let y = h;
166
+ !y && p.includes("|") ? y = p.split("|")[1].trim() : y || (y = ""), c = e.startsWith("[") ? u : c.replace(o, y);
229
167
  }
230
168
  }
231
- return inputValue ? computedValue : defaultValue || value;
232
- } else {
233
- return inputValue ? inputValue.startsWith("[") ? finalValue : value.replace("{0}", finalValue) : defaultValue || value;
234
- }
169
+ return e ? c : i || l;
170
+ } else
171
+ return e ? e.startsWith("[") ? u : l.replace("{0}", u) : i || l;
235
172
  }
236
- getParentClass(className) {
173
+ getParentClass(s) {
237
174
  return Object.keys(this.classes).filter(
238
- (cssProperty) => Object.prototype.hasOwnProperty.call(
239
- this.classes[cssProperty],
240
- className
175
+ (t) => Object.prototype.hasOwnProperty.call(
176
+ this.classes[t],
177
+ s
241
178
  )
242
179
  );
243
180
  }
244
- processCustomClass(className, value = "", unit = "", prefix = "", secValue = "", secUnit = "", isHyphen = true) {
245
- if (!className) return null;
246
- const properties = this.getParentClass(className);
247
- if (properties.length > 0) {
248
- const rules = properties.map((prop) => {
249
- const classObj = this.classes[prop];
250
- if (!classObj) return "";
251
- const processedValue = this.parseValuePattern(
252
- className,
253
- classObj[className] || "",
254
- value,
255
- unit,
256
- secValue,
257
- secUnit
181
+ processCustomClass(s, t = "", e = "", n = "", r = "", a = "", l = !0) {
182
+ if (!s) return null;
183
+ const i = this.getParentClass(s);
184
+ if (i.length > 0) {
185
+ const u = i.map((f) => {
186
+ const o = this.classes[f];
187
+ if (!o) return "";
188
+ const p = this.parseValuePattern(
189
+ s,
190
+ o[s] || "",
191
+ t,
192
+ e,
193
+ r,
194
+ a
258
195
  );
259
- return `${this.toKebabCase(String(prop))}: ${processedValue}`;
260
- }).filter(Boolean).join("; ");
261
- const isValueType = className.slice(-(value + unit).length);
262
- const finalClassName = `${className}${value ? `${isHyphen ? "-" : ""}${value}${unit}` : ""}${secValue ? `/${secValue}${secUnit}` : ""}`;
196
+ return `${this.toKebabCase(String(f))}: ${p}`;
197
+ }).filter(Boolean).join("; "), h = s.slice(-(t + e).length), c = `${s}${t ? `${l ? "-" : ""}${t}${e}` : ""}${r ? `/${r}${a}` : ""}`;
263
198
  return {
264
- className: value === isValueType ? className : finalClassName,
265
- cssRules: rules,
199
+ className: t === h ? s : c,
200
+ cssRules: u,
266
201
  value: null,
267
- prefix
202
+ prefix: n
268
203
  };
269
204
  }
270
205
  return null;
271
206
  }
272
- processAlias(className, prefix = "") {
273
- const alias = this.aliases[className];
274
- if (!alias) return null;
275
- const aliasClasses = alias.split(" ");
276
- const combinedRules = [];
277
- aliasClasses.forEach((aliasClass) => {
278
- const [rprefix, rtype] = aliasClass.split(":");
279
- const getType = rtype || rprefix;
280
- const getPrefix = rtype ? rprefix : void 0;
281
- const parts = this.parse(aliasClass);
282
- const parsed = parts ? parts : [getPrefix, getType, "", ""];
283
- if (!parsed) return;
284
- const [prefix2, type, value, unit, secValue, secUnit] = parsed;
285
- const result = this.processShorthand(type, value, unit, void 0, secValue, secUnit);
286
- const shouldClasses = this.processCustomClass(type, value, unit, prefix2, secValue, secUnit);
287
- if (shouldClasses) {
288
- const { cssRules } = shouldClasses;
289
- combinedRules.push(cssRules);
290
- return;
291
- }
292
- if (result) {
293
- const value2 = result.value !== null ? `: ${result.value}` : "";
294
- if (Array.isArray(result.cssRules)) {
295
- result.cssRules.forEach((rule) => {
296
- combinedRules.push(`${this.toKebabCase(rule)}${value2}`);
297
- });
298
- } else {
299
- combinedRules.push(`${result.cssRules}${value2}`);
300
- }
301
- }
302
- });
303
- return {
304
- className,
305
- cssRules: combinedRules.join("; "),
306
- value: null,
307
- prefix
308
- };
309
- }
310
- process(classNames) {
311
- const classList = Array.isArray(classNames) ? classNames : classNames.split(/\s+/);
312
- const results = [];
313
- classList.forEach((className) => {
314
- if (!className) return this;
315
- const [rprefix, rtype] = className.split(":");
316
- const getType = rtype || rprefix;
317
- const getPrefix = rtype ? rprefix : void 0;
318
- const aliasResult = this.processAlias(getType, getPrefix);
319
- if (aliasResult) {
320
- const { className: aliasClassName, cssRules } = aliasResult;
321
- results.push({
322
- className: aliasClassName,
323
- cssRules,
324
- value: null,
325
- prefix: getPrefix
326
- });
327
- return;
328
- }
329
- const parts = this.parse(className);
330
- const parsed = parts ? parts : [getPrefix, getType, "", ""];
331
- if (!parsed) return this;
332
- const [prefix, type, value, unit, secValue, secUnit] = parsed;
333
- const isHyphen = !className.includes((type || "") + (value || ""));
334
- const classFromClasses = this.getParentClass(`${type}${isHyphen ? "-" : ""}${value}`).length > 0 ? `${type}${isHyphen ? "-" : ""}${value}` : type;
335
- const shouldClasses = this.processCustomClass(
336
- classFromClasses,
337
- value,
338
- unit,
339
- prefix,
340
- secValue,
341
- secUnit,
342
- isHyphen
207
+ process(s) {
208
+ const t = Array.isArray(s) ? s : s.split(/\s+/), e = [];
209
+ return t.forEach((n) => {
210
+ if (!n) return this;
211
+ const [r, a] = n.split(":"), l = a || r, i = a ? r : void 0, u = this.parse(n), h = u || [i, l, "", ""];
212
+ if (!h) return this;
213
+ const [c, f, o, p, y, m] = h, C = !n.includes((f || "") + (o || "")), $ = this.getParentClass(`${f}${C ? "-" : ""}${o}`).length > 0 ? `${f}${C ? "-" : ""}${o}` : f, g = this.processCustomClass(
214
+ $,
215
+ o,
216
+ p,
217
+ c,
218
+ y,
219
+ m,
220
+ C
343
221
  );
344
- if (shouldClasses) {
345
- const { className: className2, cssRules, prefix: prefix2 } = shouldClasses;
346
- results.push({
347
- className: className2,
348
- cssRules,
222
+ if (g) {
223
+ const { className: b, cssRules: d, prefix: W } = g;
224
+ e.push({
225
+ className: b,
226
+ cssRules: d,
349
227
  value: null,
350
- prefix: prefix2
228
+ prefix: W
351
229
  });
352
230
  return;
353
231
  }
354
- const result = this.processShorthand(type, value, unit, prefix, secValue, secUnit, isHyphen);
355
- if (result) {
356
- const { className: className2, cssRules, value: ruleValue, prefix: rulePrefix } = result;
357
- results.push({
358
- className: className2,
359
- cssRules,
360
- value: ruleValue,
361
- prefix: rulePrefix
232
+ const A = this.processShorthand(f, o, p, c, y, m, C);
233
+ if (A) {
234
+ const { className: b, cssRules: d, value: W, prefix: R } = A;
235
+ e.push({
236
+ className: b,
237
+ cssRules: d,
238
+ value: W,
239
+ prefix: R
362
240
  });
363
241
  }
364
- });
365
- return results;
242
+ }), e;
366
243
  }
367
244
  }
368
245
  export {
369
- TenoxUI,
370
- TenoxUI as default
246
+ _ as TenoxUI,
247
+ _ as default
371
248
  };
372
249
  //# sourceMappingURL=index.es.js.map