aliascss 1.5.0 → 1.5.1

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.
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import extractClassNamesFromFile from "./extractClassNamesFromFile.js";
11
- import { compiler as statementMaker } from "../returnStatement-bk-291026.js";
11
+ import { compiler as statementMaker } from "../returnStatement.js";
12
12
  import config from "../config.js";
13
13
  import fs from "fs";
14
14
  import fg from "fast-glob";
@@ -62,7 +62,7 @@ export function globalCSSCompiler() {
62
62
  let basePreamble = "";
63
63
  // 1. Layer declaration
64
64
  if (Array.isArray(init.layers) && init.layers.length > 0) {
65
- basePreamble += `@layer ${init.layers.join(", ")};\n\n`;
65
+ basePreamble += `@layer ${init.layers.join(", ")};\n\n @layer reset{[hidden]:not([hidden="until-found"]){display:none!important}}\n\n`;
66
66
  init.initializedLayer = true;
67
67
  }
68
68
  // 2. Custom CSS statements & group statements
@@ -0,0 +1,30 @@
1
+ type Property = {
2
+ alias?: string;
3
+ property?: string;
4
+ type?: string;
5
+ values?: string[];
6
+ groups?: {
7
+ [key: string]: string;
8
+ };
9
+ compiler?: (...args: any[]) => any;
10
+ };
11
+ /**
12
+ * @param className : string
13
+ * @param cssPropertiesWithAlias: Compiler Object
14
+ * @param staticClassNames : StaticClassNames
15
+ * @param custom : custom values for color, font, etc
16
+ * @param extractProperty :extractProperty(className:string,cssPropertiesWithAlias:{[key:string]:Property})=>[Property,string]
17
+ * @param bool : return[property,value] or property:value
18
+ * @returns {string[]|null|{}}
19
+ */
20
+ export default function getPropertyAndValue(className: string, cssPropertiesWithAlias: {
21
+ [key: string]: Property;
22
+ }, staticClassNames: {
23
+ [key: string]: string;
24
+ }, custom: {
25
+ [key: string]: {
26
+ [key: string]: string;
27
+ };
28
+ }, extractProperty: any, // (a:string,b:{[key:string]:Property})=>[Property,string],
29
+ bool?: boolean): string[] | null | {};
30
+ export {};
@@ -0,0 +1,219 @@
1
+ /**
2
+ * @param className : string
3
+ * @param cssPropertiesWithAlias: Compiler Object
4
+ * @param staticClassNames : StaticClassNames
5
+ * @param custom : custom values for color, font, etc
6
+ * @param extractProperty :extractProperty(className:string,cssPropertiesWithAlias:{[key:string]:Property})=>[Property,string]
7
+ * @param bool : return[property,value] or property:value
8
+ * @returns {string[]|null|{}}
9
+ */
10
+ export default function getPropertyAndValue(className, cssPropertiesWithAlias, staticClassNames, custom, extractProperty, // (a:string,b:{[key:string]:Property})=>[Property,string],
11
+ bool = false) {
12
+ var _a;
13
+ // Case 1 StaticClassNames
14
+ if (staticClassNames.hasOwnProperty(className)) {
15
+ return staticClassNames[className];
16
+ }
17
+ // case 2 defining css-variable as className
18
+ if (className.startsWith('--') && className.includes(':')) {
19
+ let value = className.slice(className.indexOf(':')).replace(':', '');
20
+ const property = className.replace(value, '').replace(':', '');
21
+ let possiblePropsName = '';
22
+ const camelCasePropertyHint = (_a = property.match(/[A-Z][a-z0-9]*$/)) === null || _a === void 0 ? void 0 : _a[0];
23
+ if (camelCasePropertyHint) {
24
+ possiblePropsName = camelCasePropertyHint.toLowerCase();
25
+ }
26
+ else {
27
+ possiblePropsName = property.slice(property.lastIndexOf('-') + 1);
28
+ }
29
+ let compiler = null;
30
+ if (cssPropertiesWithAlias.hasOwnProperty(possiblePropsName) && cssPropertiesWithAlias[possiblePropsName].hasOwnProperty('compiler') && typeof cssPropertiesWithAlias[possiblePropsName].compiler === 'function') {
31
+ compiler = cssPropertiesWithAlias[possiblePropsName].compiler;
32
+ }
33
+ // if value is function i.e --some-var:(12px,red,blue);
34
+ if (/^\(.+\)[_]?$/.test(value)) {
35
+ if (value.match(/_$/)) {
36
+ // replace --[name] with var(--[name])
37
+ const val = value.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
38
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
39
+ .replace(/,/g, ', ');
40
+ value = val.replace(/_/g, ' ');
41
+ }
42
+ else {
43
+ const val = value.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
44
+ .replace(/^[(]/, '').replace(/[)]$/, '')
45
+ // .replace(/,/g,' ');
46
+ .replace(/,/g, ', ');
47
+ // value=val.replace(/_/g,' ');
48
+ value = val.replace(/\\_|_/g, (m) => (m === '_' ? ' ' : '_'));
49
+ ;
50
+ }
51
+ return bool ? [property, value] : property + ":" + value;
52
+ }
53
+ //
54
+ // case 1: CSS Variable inside css variable
55
+ if (/^calc/.test(value)) {
56
+ return bool ? [property, value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2')] : property + ":" + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2');
57
+ }
58
+ // case 2: CSS variable in side css variable
59
+ if (/^--[a-zA-Z]/.test(value)) {
60
+ if (value.includes(':')) {
61
+ let val = value.slice(value.indexOf(':')).replace(':', '');
62
+ const cssVar = value.replace(val, '').replace(':', '');
63
+ if (compiler && typeof compiler === 'function') {
64
+ const v = compiler(val, custom);
65
+ val = v ? v : val;
66
+ }
67
+ return bool ? [property, "var(" + cssVar + ',' + val + ')'] : property + ": var(" + cssVar + ',' + val + ')';
68
+ }
69
+ else if (compiler && compiler.name === 'color') {
70
+ return bool ? [property, compiler(value)] : property + ":" + compiler(value);
71
+ }
72
+ return bool ? [property, "var(" + value + ')'] : property + ": var(" + value + ')';
73
+ }
74
+ else {
75
+ // If has text in end
76
+ if (/text$/.test(property)) {
77
+ const v = '"' + value.replace(/([_]?)[_]/g, '$1 ').replace(/_[\s]/g, '_') + '"';
78
+ return bool ? [property, v] : property + ":" + v;
79
+ }
80
+ // Rest
81
+ if (compiler && typeof compiler === 'function') {
82
+ const v = compiler(value, custom);
83
+ value = v ?
84
+ v
85
+ :
86
+ value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ')
87
+ .replace(/auto flow/g, 'auto-flow')
88
+ .replace(/__/g, " ")
89
+ .replace(/[\s](mix|cmyk|set|gradient|bezier|content|shadow|rotate|dark|conic|linear|radial)/g, '-$1');
90
+ }
91
+ else {
92
+ value = value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ')
93
+ .replace(/auto flow/g, 'auto-flow')
94
+ .replace(/__/g, " ")
95
+ .replace(/[\s](mix|cmyk|set|gradient|bezier|content|shadow|rotate|dark|conic|linear|radial)/g, '-$1');
96
+ }
97
+ return bool ? [property, value] : property + ":" + value;
98
+ }
99
+ }
100
+ // End of CSS-variable as a className
101
+ const [property, propertyKey] = extractProperty(className, cssPropertiesWithAlias);
102
+ // console.log(propertyKey,'ttt',property,className)
103
+ if (property) {
104
+ // check for type='group'
105
+ if (property.hasOwnProperty('type') && property.type === "group") {
106
+ const valuePortion = className.replace(propertyKey, '');
107
+ if (property.hasOwnProperty('groups') && property.groups.hasOwnProperty(valuePortion.replace(/^-/, ''))) {
108
+ return property.groups[valuePortion.replace(/^-/, '')];
109
+ }
110
+ return property.compiler(valuePortion, custom) || '';
111
+ }
112
+ // --End of Group type
113
+ const prop = property.property ? property.property : propertyKey;
114
+ // Case 2: CSS Variables
115
+ if (/--var--/.test(className)) {
116
+ const splits = className.split(/--var--/);
117
+ if (cssPropertiesWithAlias.hasOwnProperty(splits[0])) {
118
+ if (splits[1].includes(':')) {
119
+ let value = splits[1].slice(splits[1].indexOf(':')).replace(':', '');
120
+ const cssVar = splits[1].replace(value, '').replace(':', '');
121
+ if (/^calc\(/.test(value)) {
122
+ return bool ? [prop, "var(--" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')'] : prop + ": var(--" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')';
123
+ }
124
+ if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
125
+ const val = property.compiler(value, custom);
126
+ value = val ? val : value;
127
+ }
128
+ return bool ? [prop, "var(--" + cssVar + ',' + value + ')'] : prop + ": var(--" + cssVar + ',' + value + ')';
129
+ }
130
+ return bool ? [prop, "var(--" + splits[1] + ')'] : prop + ": var(--" + splits[1] + ')';
131
+ }
132
+ }
133
+ const valuePortion = className.replace(propertyKey, '');
134
+ // New Update function value
135
+ if (/^\(.+\)[_]?$/.test(valuePortion)) {
136
+ if (valuePortion.match(/_$/)) {
137
+ const val = valuePortion.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
138
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
139
+ .replace(/,/g, ', ')
140
+ .replace(/[_]/g, ' ');
141
+ return bool ? [prop, val] : prop + ":" + val;
142
+ }
143
+ else {
144
+ const val = valuePortion.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
145
+ .replace(/^[(]/, '').replace(/[)]$/, '')
146
+ // .replace(/,/g,' ')
147
+ .replace(/,/g, ', ')
148
+ // .replace(/[_]/g,' ');
149
+ .replace(/\\_|_/g, (m) => (m === '_' ? ' ' : '_'));
150
+ return bool ? [prop, val] : prop + ":" + val;
151
+ }
152
+ }
153
+ // case 3: calc function
154
+ if (/^-calc\(/.test(valuePortion)) {
155
+ return bool ? [prop, valuePortion.replace(/^-/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2')] : prop + ":" + valuePortion.replace(/^-/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2');
156
+ }
157
+ // case 4: CSS variable without --var keyword
158
+ if (/^--[a-zA-Z]/.test(valuePortion)) {
159
+ if (valuePortion.includes(':')) {
160
+ let value = valuePortion.slice(valuePortion.indexOf(':')).replace(':', '');
161
+ const cssVar = valuePortion.replace(value, '').replace(':', '');
162
+ // check if has :()
163
+ if (/^\(.+\)[_]?$/.test(value)) {
164
+ if (value.match(/_$/)) {
165
+ const val = value.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
166
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
167
+ .replace(/,/g, ', ');
168
+ value = val;
169
+ }
170
+ else {
171
+ const val = value.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
172
+ .replace(/^[(]/, '').replace(/[)]$/, '')
173
+ .replace(/,/g, ' ');
174
+ value = val;
175
+ }
176
+ return bool ? [prop, "var(" + cssVar + ',' + value + ')'] : prop + ": var(" + cssVar + ',' + value + ')';
177
+ }
178
+ //
179
+ if (/^calc\(/.test(value)) {
180
+ return bool ? [prop, "var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')'] : prop + ": var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')';
181
+ }
182
+ if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
183
+ const val = property.compiler(value, custom);
184
+ value = val ? val : value;
185
+ }
186
+ return bool ? [prop, "var(" + cssVar + ',' + value + ')'] : prop + ": var(" + cssVar + ',' + value + ')';
187
+ }
188
+ if (/(background|color)$/.test(prop)) {
189
+ if (cssPropertiesWithAlias.color.compiler && typeof cssPropertiesWithAlias.color.compiler === 'function') {
190
+ const value = cssPropertiesWithAlias.color.compiler(valuePortion, custom);
191
+ return bool ? [prop, value] : prop + ":" + value;
192
+ }
193
+ }
194
+ return bool ? [prop, "var(" + valuePortion + ')'] : prop + ": var(" + valuePortion + ')';
195
+ }
196
+ if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
197
+ // const value=property.compiler(valuePortion.replace(/^-/,'') ,custom);
198
+ const value = property.compiler(valuePortion, custom);
199
+ // console.log(value,valuePortion,property)
200
+ if (value && value !== '-') {
201
+ const val = value.replace(/([-]?)([\d]|10|11|12)col/g, (m, p1, p2) => `${p1}${parseFloat(((100 / 12) * parseFloat(p2)).toFixed(6))}%`);
202
+ return bool ? [prop, val] : prop + ":" + val;
203
+ }
204
+ else {
205
+ console.log(`${className}: '${propertyKey}' unable to compile value:${className.replace(propertyKey, '')} returning value as it is`);
206
+ return bool ? [prop, (valuePortion.replace(/^-/, '')) ? valuePortion.replace(/^-/, '') : 'initial' + ` /* ***Warning:Might not be Valid value *** */`] : prop + ":" + (valuePortion.replace(/^-/, '')) ? valuePortion.replace(/^-/, '') : 'initial' + ` /* ***Warning:Might not be Valid value *** */`;
207
+ }
208
+ }
209
+ else {
210
+ console.log("No Compiler found for:" + className + " invalidating static className definition, add compiler function to get as it is value.");
211
+ // Saving Static Value
212
+ // return bool?[prop,valuePortion.replace(/^-/,'')+` /* ***Warning:Might not be Valid value *** */`]:prop+":"+valuePortion.replace(/^-/,'')+` /* ***Warning:Might not be Valid value *** */`;
213
+ }
214
+ }
215
+ else {
216
+ console.log(`${className}: is not valid AliasCSS class name, property definition not found`);
217
+ }
218
+ return bool ? [null, null] : null;
219
+ }
@@ -1,3 +1,18 @@
1
+ /**
2
+ * A value written after ":" has no separator dash, but property compilers expect the value
3
+ * exactly as it follows the property in a normal class: "-8px" in m-8px (dash = separator),
4
+ * "--8px" in m--8px (negative). Put the separator back so ":-8px" compiles like m--8px.
5
+ * ":--8px" is accepted as negative too.
6
+ */
7
+ const asClassValue = (value) => '-' + value.replace(/^--(?=[\d.])/, '-');
8
+ /** Value clean-up used when no compiler handles the value (same rules as before, sign-safe). */
9
+ const fallbackValue = (value) => asClassValue(value)
10
+ .replace(/[-]([-]?[\w])/g, ' $1')
11
+ .trimStart() // drop the separator before keyword fixes below
12
+ .replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ')
13
+ .replace(/auto flow/g, 'auto-flow')
14
+ .replace(/__/g, " ")
15
+ .replace(/[\s](mix|cmyk|set|gradient|bezier|content|shadow|rotate|dark|conic|linear|radial)/g, '-$1');
1
16
  /**
2
17
  * @param className : string
3
18
  * @param cssPropertiesWithAlias: Compiler Object
@@ -61,7 +76,7 @@ bool = false) {
61
76
  let val = value.slice(value.indexOf(':')).replace(':', '');
62
77
  const cssVar = value.replace(val, '').replace(':', '');
63
78
  if (compiler && typeof compiler === 'function') {
64
- const v = compiler(val, custom);
79
+ const v = compiler(asClassValue(val), custom);
65
80
  val = v ? v : val;
66
81
  }
67
82
  return bool ? [property, "var(" + cssVar + ',' + val + ')'] : property + ": var(" + cssVar + ',' + val + ')';
@@ -78,22 +93,8 @@ bool = false) {
78
93
  return bool ? [property, v] : property + ":" + v;
79
94
  }
80
95
  // Rest
81
- if (compiler && typeof compiler === 'function') {
82
- const v = compiler(value, custom);
83
- value = v ?
84
- v
85
- :
86
- value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ')
87
- .replace(/auto flow/g, 'auto-flow')
88
- .replace(/__/g, " ")
89
- .replace(/[\s](mix|cmyk|set|gradient|bezier|content|shadow|rotate|dark|conic|linear|radial)/g, '-$1');
90
- }
91
- else {
92
- value = value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ')
93
- .replace(/auto flow/g, 'auto-flow')
94
- .replace(/__/g, " ")
95
- .replace(/[\s](mix|cmyk|set|gradient|bezier|content|shadow|rotate|dark|conic|linear|radial)/g, '-$1');
96
- }
96
+ const v = compiler && typeof compiler === 'function' ? compiler(asClassValue(value), custom) : null;
97
+ value = v ? v : fallbackValue(value);
97
98
  return bool ? [property, value] : property + ":" + value;
98
99
  }
99
100
  }
@@ -122,7 +123,7 @@ bool = false) {
122
123
  return bool ? [prop, "var(--" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')'] : prop + ": var(--" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')';
123
124
  }
124
125
  if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
125
- const val = property.compiler(value, custom);
126
+ const val = property.compiler(asClassValue(value), custom);
126
127
  value = val ? val : value;
127
128
  }
128
129
  return bool ? [prop, "var(--" + cssVar + ',' + value + ')'] : prop + ": var(--" + cssVar + ',' + value + ')';
@@ -180,7 +181,7 @@ bool = false) {
180
181
  return bool ? [prop, "var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')'] : prop + ": var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')';
181
182
  }
182
183
  if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
183
- const val = property.compiler(value, custom);
184
+ const val = property.compiler(asClassValue(value), custom);
184
185
  value = val ? val : value;
185
186
  }
186
187
  return bool ? [prop, "var(" + cssVar + ',' + value + ')'] : prop + ": var(" + cssVar + ',' + value + ')';
@@ -202,18 +203,18 @@ bool = false) {
202
203
  return bool ? [prop, val] : prop + ":" + val;
203
204
  }
204
205
  else {
205
- console.log(`${className}: '${propertyKey}' unable to compile value:${className.replace(propertyKey, '')} returning value as it is`);
206
- return bool ? [prop, (valuePortion.replace(/^-/, '')) ? valuePortion.replace(/^-/, '') : 'initial' + ` /* ***Warning:Might not be Valid value *** */`] : prop + ":" + (valuePortion.replace(/^-/, '')) ? valuePortion.replace(/^-/, '') : 'initial' + ` /* ***Warning:Might not be Valid value *** */`;
206
+ const asWritten = valuePortion.replace(/^-/, '');
207
+ console.warn(`AliasCSS: "${className}": couldn't compile the value "${asWritten}", used it as written`);
208
+ const v = asWritten ? asWritten : 'initial /* ***Warning:Might not be Valid value *** */';
209
+ // (the old one-liner returned only the value: `prop + ":" + x ? x : …` parses as `(prop + ":" + x) ? x : …`)
210
+ return bool ? [prop, v] : prop + ":" + v;
207
211
  }
208
212
  }
209
213
  else {
210
- console.log("No Compiler found for:" + className + " invalidating static className definition, add compiler function to get as it is value.");
211
214
  // Saving Static Value
212
215
  // return bool?[prop,valuePortion.replace(/^-/,'')+` /* ***Warning:Might not be Valid value *** */`]:prop+":"+valuePortion.replace(/^-/,'')+` /* ***Warning:Might not be Valid value *** */`;
213
216
  }
214
217
  }
215
- else {
216
- console.log(`${className}: is not valid AliasCSS class name, property definition not found`);
217
- }
218
+ // Not an AliasCSS class (e.g. a plain "card-title"): stay quiet, compiler.ts decides whether to warn
218
219
  return bool ? [null, null] : null;
219
220
  }
@@ -131,9 +131,12 @@ export const compiler = {
131
131
  }
132
132
  }
133
133
  // Budle atomice class name in new
134
+ // --as-name or --as-[name1,name2,…]: compile the group once per name
134
135
  const asMatch = className.match(AS_EXPORT);
135
136
  if ((_a = asMatch === null || asMatch === void 0 ? void 0 : asMatch.groups) === null || _a === void 0 ? void 0 : _a.names) {
136
- return this.group(className.slice(0, asMatch.index), asMatch.groups.names);
137
+ const body = className.slice(0, asMatch.index);
138
+ const names = asMatch.groups.names.replace(/^\[|\]$/g, '').split(',');
139
+ return names.map((name) => this.group(body, name)).join('');
137
140
  }
138
141
  let unPrefixedClassName = className;
139
142
  // check for [group-acss,]
@@ -270,7 +273,8 @@ export const compiler = {
270
273
  console.warn(`AliasCSS: "${as ? as : className}" produced invalid CSS:`, stm);
271
274
  }
272
275
  else {
273
- const looksLikeAcss = ACSS_SYNTAX.test(className) || !!extractProperty(pnv, this.cssProps);
276
+ // extractProperty returns [property, key] even when nothing matched, so test the property itself
277
+ const looksLikeAcss = ACSS_SYNTAX.test(className) || !!extractProperty(pnv, this.cssProps)[0];
274
278
  if (!this.groupDepth && (looksLikeAcss || config.debug)) {
275
279
  console.warn(`AliasCSS: can't compile "${className}"`);
276
280
  }
@@ -4,8 +4,22 @@ export function splitByCommaOutsideParens(str) {
4
4
  const result = [];
5
5
  let current = '';
6
6
  let depth = 0;
7
- for (let i = 0; i < str.length; i++) {
8
- const char = str[i];
7
+ // for (let i = 0; i < str.length; i++) {
8
+ // const char = str[i];
9
+ // if (char === '(') {
10
+ // depth++;
11
+ // current += char;
12
+ // } else if (char === ')') {
13
+ // depth = Math.max(0, depth - 1);
14
+ // current += char;
15
+ // } else if (char === ',' && depth === 0) {
16
+ // result.push(current.trim());
17
+ // current = '';
18
+ // } else {
19
+ // current += char;
20
+ // }
21
+ // }
22
+ for (const char of str) {
9
23
  if (char === '(') {
10
24
  depth++;
11
25
  current += char;
@@ -60,6 +60,7 @@ const formComponents = {
60
60
  @components[d-inline-flex,aic,jcc,g-8px,box-sizing-border-box,h--x-form-height:40px,padding-inline--x-button-padding:16px,br--x-form-radius:8px,border-width-1px,border-style-solid,border-color--x-button-border-color:transparent,bgc--x-button-bg:accentRA1000,c--x-button-color:white,fs--x-button-font-size:15px,fw-600,lh-1,white-space-nowrap,user-select-none,cursor-pointer,transition-property-background-color__border-color__color__transform,transition-duration-0.15s]
61
61
  @components--enabled--hover-bgc--x-button-hover-bg:accentRA1100
62
62
  @components--enabled--active-tf-scale-0.98
63
+ @components__svg-flex-shrink-0
63
64
  ${focusVisible}
64
65
  @components--disabled[o-0.5,cursor-not-allowed]
65
66
  @components-[aria-disabled=true][o-0.5,cursor-not-allowed,pointer-events-none]
@@ -88,7 +89,7 @@ const formComponents = {
88
89
  'x-button-icon': {
89
90
  // square icon-only button: <button class="x-button x-button-icon" aria-label="Close">…</button>
90
91
  type: 'statement',
91
- statement: `--x-button-padding:0px w--x-form-height:40px`
92
+ statement: `--x-button-padding:0px @components-[class][padding-inline-0,w--x-form-height:40px,flex-shrink-0]`
92
93
  },
93
94
  // ---------------- Text fields ----------------
94
95
  // <input class="x-input" type="email">