@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/README.md +4 -71
- package/dist/index.cjs +1 -371
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.es.js +193 -316
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +1 -374
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +1 -375
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +2 -4
- package/package.json +1 -1
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
|
-
|
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
|
2
|
-
var
|
3
|
-
var
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
18
|
-
constructor({ property = {}, values = {}, classes
|
19
|
-
this.property =
|
20
|
-
moxie: ({ key }) =>
|
21
|
-
},
|
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(
|
27
|
-
if (/^(webkit|moz|ms|o)[A-Z]/.test(
|
28
|
-
const
|
29
|
-
if (
|
30
|
-
const
|
31
|
-
return `-${
|
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
|
26
|
+
return s.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
35
27
|
}
|
36
|
-
escapeCSSSelector(
|
37
|
-
return
|
28
|
+
escapeCSSSelector(s) {
|
29
|
+
return s.replace(/([ #{}.:;?%&,@+*~'"!^$[\]()=>|/])/g, "\\$1");
|
38
30
|
}
|
39
|
-
getAllClassNames(
|
40
|
-
if (!
|
41
|
-
const
|
42
|
-
Object.entries(
|
43
|
-
|
44
|
-
|
45
|
-
|
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(
|
52
|
-
const
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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(
|
63
|
-
const
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
-
|
54
|
+
a + l + i + u + h + c
|
79
55
|
);
|
80
56
|
}
|
81
|
-
parse(
|
82
|
-
if (Object.values(this.classes).some((
|
83
|
-
return [void 0,
|
84
|
-
|
85
|
-
|
86
|
-
const
|
87
|
-
|
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(
|
94
|
-
if (!
|
95
|
-
const
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
80
|
+
return s + (t || "");
|
117
81
|
}
|
118
|
-
processShorthand(
|
119
|
-
const
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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: `${`[${
|
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 (
|
151
|
-
if (typeof
|
152
|
-
const
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
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
|
-
|
172
|
-
const
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
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(
|
180
|
-
value:
|
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
|
185
|
-
value:
|
186
|
-
unit,
|
187
|
-
secondValue:
|
188
|
-
secondUnit,
|
189
|
-
key:
|
190
|
-
}) :
|
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: `${
|
193
|
-
cssRules: Array.isArray(
|
194
|
-
value: typeof
|
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(
|
201
|
-
if (!
|
202
|
-
return
|
203
|
-
const [
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
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
|
232
|
-
} else
|
233
|
-
return
|
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(
|
173
|
+
getParentClass(s) {
|
237
174
|
return Object.keys(this.classes).filter(
|
238
|
-
(
|
239
|
-
this.classes[
|
240
|
-
|
175
|
+
(t) => Object.prototype.hasOwnProperty.call(
|
176
|
+
this.classes[t],
|
177
|
+
s
|
241
178
|
)
|
242
179
|
);
|
243
180
|
}
|
244
|
-
processCustomClass(
|
245
|
-
if (!
|
246
|
-
const
|
247
|
-
if (
|
248
|
-
const
|
249
|
-
const
|
250
|
-
if (!
|
251
|
-
const
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
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(
|
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:
|
265
|
-
cssRules:
|
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
|
-
|
273
|
-
const
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
const [
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
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 (
|
345
|
-
const { className:
|
346
|
-
|
347
|
-
className:
|
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:
|
228
|
+
prefix: W
|
351
229
|
});
|
352
230
|
return;
|
353
231
|
}
|
354
|
-
const
|
355
|
-
if (
|
356
|
-
const { className:
|
357
|
-
|
358
|
-
className:
|
359
|
-
cssRules,
|
360
|
-
value:
|
361
|
-
prefix:
|
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
|
-
|
246
|
+
_ as TenoxUI,
|
247
|
+
_ as default
|
371
248
|
};
|
372
249
|
//# sourceMappingURL=index.es.js.map
|