aliascss 1.4.7 → 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.
Files changed (53) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/bin/aliascss.js +118 -1
  3. package/dist/aliascss.js +1 -1
  4. package/jestconfig.json +1 -3
  5. package/lib/build/index.js +136 -19
  6. package/lib/classPrinter.d.ts +1 -1
  7. package/lib/classPrinter.js +351 -23
  8. package/lib/compilers/border.js +106 -27
  9. package/lib/compilers/clipPath.js +79 -6
  10. package/lib/compilers/color.js +150 -21
  11. package/lib/compilers/filter.js +90 -3
  12. package/lib/compilers/font.js +39 -11
  13. package/lib/compilers/gradient.js +43 -27
  14. package/lib/compilers/length.js +34 -9
  15. package/lib/compilers/shadow.js +60 -26
  16. package/lib/compilers/stringAndContent.js +39 -2
  17. package/lib/compilers/timingFunction.js +57 -6
  18. package/lib/compilers/transform.js +118 -48
  19. package/lib/compilers/transition.js +79 -11
  20. package/lib/compilers/url.js +53 -3
  21. package/lib/config.d.ts +1 -0
  22. package/lib/config.js +1 -0
  23. package/lib/custom-css-compilers.js +1 -68
  24. package/lib/index.d.ts +9 -9
  25. package/lib/node/compileFile-BK-291026.d.ts +27 -0
  26. package/lib/node/compileFile-BK-291026.js +309 -0
  27. package/lib/node/compileFile-bk.d.ts +14 -12
  28. package/lib/node/compileFile-bk.js +263 -252
  29. package/lib/node/compileFile.js +1 -1
  30. package/lib/node/extractClassNamesFromFile.js +208 -86
  31. package/lib/prebuild.d.ts +26 -0
  32. package/lib/prebuild.js +0 -6
  33. package/lib/prefix/element-selector.js +93 -20
  34. package/lib/prefix/extractPrefix.d.ts +1 -1
  35. package/lib/prefix/extractPrefix.js +113 -70
  36. package/lib/returnPropertyAndValue-bk-301026.d.ts +30 -0
  37. package/lib/returnPropertyAndValue-bk-301026.js +219 -0
  38. package/lib/returnPropertyAndValue.js +26 -25
  39. package/lib/returnStatement-bk-291026.d.ts +5 -0
  40. package/lib/returnStatement-bk-291026.js +470 -0
  41. package/lib/returnStatement.d.ts +1 -0
  42. package/lib/returnStatement.js +120 -29
  43. package/lib/utils/helper.js +16 -2
  44. package/lib/x-classes/x-bundle.d.ts +26 -0
  45. package/lib/x-classes/x-bundle.js +2 -1
  46. package/lib/x-classes/x-extras.js +1 -1
  47. package/lib/x-classes/x-form-components.js +2 -1
  48. package/lib/x-classes/x-row-col.d.ts +29 -0
  49. package/lib/x-classes/x-row-col.js +52 -0
  50. package/llms.txt +326 -0
  51. package/package.json +3 -1
  52. package/tsconfig.json +1 -0
  53. package/tsconfig.test.json +10 -0
@@ -0,0 +1,470 @@
1
+ import getPropertyAndValue from "./returnPropertyAndValue.js";
2
+ import { customStaticClassNames } from "./static/customStaticClassNames.js";
3
+ import media, { createRegexForMedia } from "./prefix/responsive.js";
4
+ import { customColors } from './static/customColors.js';
5
+ import { customColorsRa } from './static/customColorsRA.js';
6
+ // import {customColors as customColors2} from './static/customColors2.js'
7
+ import { customColorsRadixUi } from './static/customColorsRadix.js';
8
+ import extractPrefix from './prefix/extractPrefix.js';
9
+ import extractMediaPrefix from './prefix/extractMediaPrefix.js';
10
+ import { createCompilerObj, extractProperty } from "./utils/createCompilerObj.js";
11
+ import config from "./config.js";
12
+ import cssProps from "./css-properties-all.js";
13
+ import { staticClassNamesAlias } from "./static/staticClassNamesAlias.js";
14
+ import postcss from "postcss";
15
+ import { splitByCommaOutsideParens, matchTrailingGroup, splitTopLevel, joinGroupItem } from "./utils/helper.js";
16
+ import cssCustomCompilers from "./custom-css-compilers.js";
17
+ // import customGroups from './prebuild.js';
18
+ const [staticClassNamesWithAlias, cssPropsWithAlias] = createCompilerObj(cssProps, config.globalValues);
19
+ const NAME = '[a-zA-Z_][\\w-]*(?:\\/[a-zA-Z_][\\w-]*)*';
20
+ const AS_EXPORT = new RegExp(`--as-(?<names>${NAME}|\\[${NAME}(?:,${NAME})*\\])$`);
21
+ export const compiler = {
22
+ // cache will cache propertyAndValue
23
+ cache: { propertyAndValue: Object.assign({}, customStaticClassNames) },
24
+ // custom:{...{colors:{...customColors,...customColors2,...customColorsRadix}}},
25
+ custom: Object.assign({ colors: Object.assign(Object.assign(Object.assign({}, customColors), customColorsRadixUi), customColorsRa) }),
26
+ mediaSelector: Object.assign({}, media.target),
27
+ mediaTest: null,
28
+ staticClassNames: Object.assign(Object.assign({}, staticClassNamesAlias), staticClassNamesWithAlias),
29
+ cssProps: Object.assign(Object.assign({}, cssPropsWithAlias), cssCustomCompilers),
30
+ prefix: null,
31
+ rawCSS: null,
32
+ customGroupStatement: null,
33
+ extend(data) {
34
+ Object.keys(data).forEach((key) => {
35
+ if (data[key].hasOwnProperty('extend')) {
36
+ if (cssProps.hasOwnProperty(data[key].extend)) {
37
+ Object.keys(cssProps[data[key].extend]).forEach((each) => {
38
+ if (each === 'values') {
39
+ data[key].values = [...cssProps[data[key].extend].values || [], ...data[key].values || []];
40
+ }
41
+ else if (each === 'compiler') {
42
+ data[key].compiler = cssProps[data[key].extend].compiler;
43
+ }
44
+ });
45
+ }
46
+ }
47
+ });
48
+ const [staticClassNames, compiler] = createCompilerObj(data, config.globalValues);
49
+ this.cssProps = Object.assign(Object.assign({}, this.cssProps), compiler);
50
+ this.staticClassNames = Object.assign(Object.assign({}, this.staticClassNames), staticClassNames);
51
+ },
52
+ // className as another-name, bool->only return property and value
53
+ make(className, as, bool) {
54
+ var _a;
55
+ // --Group Statement
56
+ if (this.cssProps.hasOwnProperty(className)) {
57
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'statement')) {
58
+ return this.group(this.cssProps[className].statement, className);
59
+ }
60
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'raw')) {
61
+ return this.cssProps[className].statement;
62
+ }
63
+ }
64
+ // Budle atomice class name in new
65
+ if (AS_EXPORT.test(className)) {
66
+ const asMatch = (_a = className.match(AS_EXPORT)) !== null && _a !== void 0 ? _a : [null, null];
67
+ if (asMatch[0] && asMatch[1]) {
68
+ return this.group(className.replace(asMatch[0], ''), asMatch[1]);
69
+ }
70
+ }
71
+ let unPrefixedClassName = className;
72
+ // check for [group-acss,]
73
+ // old
74
+ // const matchGroupCSS=className.match(/\[([^[]*)\]$/);
75
+ // if(matchGroupCSS){
76
+ // const asString=splitByCommaOutsideParens(matchGroupCSS[1])
77
+ // // .split(',')
78
+ // .map(e=>(className.replace(matchGroupCSS[0],'')+"-").replace(/--$/,'-')+e.replace(/^--/,'-'))
79
+ // .join(' ');
80
+ // return this.group(asString,as?as:className);
81
+ // }
82
+ // --end old
83
+ // New
84
+ const grp = matchTrailingGroup(className);
85
+ if (grp) {
86
+ const asString = splitTopLevel(grp.body).map(e => joinGroupItem(grp.prefix, e)).join(' ');
87
+ return this.group(asString, as ? as : className);
88
+ }
89
+ // EONEW
90
+ let beforeClassNameSelector = '';
91
+ if (this.prefix && !className.match(new RegExp('^' + this.prefix + "[-]"))) {
92
+ return null;
93
+ }
94
+ else if (this.prefix) {
95
+ unPrefixedClassName = className.replace(new RegExp('^' + this.prefix + "[-]"), '');
96
+ }
97
+ if (!this.mediaTest)
98
+ this.mediaTest = createRegexForMedia(this.mediaSelector);
99
+ // 1. check and extract Media prefix and return className with prefix treatment,
100
+ let [extractedMedia, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
101
+ const mediaEX = extractedMedia;
102
+ // lint escape for const
103
+ extractedMedia = extractedMedia;
104
+ // 2. search for '&' which tells us to use selector before or after className
105
+ if (workingClassName.match(/[&]/)) {
106
+ const [before, after] = workingClassName.split('&');
107
+ beforeClassNameSelector = extractPrefix(before + "-display-none")[0] + " ";
108
+ if (!beforeClassNameSelector.trim()) {
109
+ console.error('Not a valid AliasCSS className:' + className, 'Make sure to provide valid css aliascss selector before "&" identifier');
110
+ return null;
111
+ }
112
+ else {
113
+ beforeClassNameSelector = beforeClassNameSelector.replace(/^([\s]?[+~>])(.*)/, "$2$1 ");
114
+ }
115
+ workingClassName = workingClassName.replace(before, '').replace('&', '');
116
+ }
117
+ let [elementAndPseudo, important] = ['', ''];
118
+ // workingClassName=workingClassName.replace(/[_][\.]([a-zA-Z])/g,(s,e)=>"_"+'ACSS').replace(/[.]/g,"d").replace(/[%]/g,'p')
119
+ // 3. Process --important flag
120
+ if (/(-i|--important)$/.test(className)) {
121
+ important = ' !important';
122
+ workingClassName = workingClassName.replace(/(-i|--important)$/, '');
123
+ }
124
+ // 4. process Pseudo State
125
+ const prefixPseudoElementAttribute = extractPrefix(workingClassName);
126
+ workingClassName = prefixPseudoElementAttribute[1];
127
+ elementAndPseudo = prefixPseudoElementAttribute[0];
128
+ // ---------------------------------------------------------------------
129
+ const pnv = workingClassName.replace(/^-([a-zA-Z])/, '$1');
130
+ let result = '';
131
+ // x-class
132
+ // if(/^(x-width|x-height)/.test(pnv)){
133
+ // const extract=getPropertyAndValue(pnv.replace('x-',''), this.cssProps, this.staticClassNames, this.custom,extractProperty);
134
+ // if(typeof extract === 'string'){
135
+ // const [p,v]=extract.split(':');
136
+ // if(p && v){
137
+ // result=`${p}:calc(${v} + var(--x-${p}-grow,0px) - var(--x-${p}-shrink,0px));`
138
+ // }
139
+ // }
140
+ // }else
141
+ if (this.cache.propertyAndValue.hasOwnProperty(pnv)) {
142
+ result = this.cache.propertyAndValue[pnv];
143
+ }
144
+ else {
145
+ try {
146
+ result = getPropertyAndValue(pnv, this.cssProps, this.staticClassNames, this.custom, extractProperty);
147
+ }
148
+ catch (error) {
149
+ console.log(error);
150
+ }
151
+ }
152
+ // if(result){
153
+ // className=className.replace(/([$.&%=\]\[@~:*#+\(\)\/^])/g,'\\$1');
154
+ // if(bool===true) return result;
155
+ // this.cache.propertyAndValue[pnv]=result;
156
+ // if(media){
157
+ // return `${media}{${
158
+ // beforeClassNameSelector+'.'+(as?as:className)+ elementAndPseudo
159
+ // }{${result}${important}}}`;
160
+ // }else{
161
+ // return `${beforeClassNameSelector}.${(as?as:className)}${elementAndPseudo}{${result}${important}}`;
162
+ // }
163
+ // }else{
164
+ // console.log(`Unable to process ${className} [media:${media},pseudoSelector:${elementAndPseudo},imp:${important}]`)
165
+ // }
166
+ // ------------PostCSSParse
167
+ if (result) {
168
+ let stm = '';
169
+ className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)\/^/</>\\|])/g, '\\$1');
170
+ if (bool === true)
171
+ return result;
172
+ this.cache.propertyAndValue[pnv] = result;
173
+ if (mediaEX.length) {
174
+ let [bf, af] = ['', ''];
175
+ mediaEX.map((e) => {
176
+ const mediaQuery = e.split('::::')[0];
177
+ const mediaPrefix = e.split('::::')[1].replace(/^@/, '');
178
+ if (['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(mediaPrefix) !== -1) {
179
+ bf = bf + `@layer ${mediaPrefix}{ ${mediaQuery} {`;
180
+ af = af + "}}";
181
+ }
182
+ else {
183
+ bf = bf + mediaQuery + "{ ";
184
+ af = af + "}";
185
+ }
186
+ });
187
+ stm = `${bf}${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}${af}`;
188
+ }
189
+ else {
190
+ stm = `${beforeClassNameSelector}.${className}${elementAndPseudo}{${result}${important}}`;
191
+ }
192
+ try {
193
+ postcss.parse(stm);
194
+ return stm;
195
+ }
196
+ catch (error) {
197
+ console.log('Not a Valid CSS Statement, PostCSS Parse:', stm);
198
+ }
199
+ }
200
+ else {
201
+ const looksLikeAcss = (name, pnv) => /^[@_\[]|^--|--as-|\[.*\]$/.test(name) || // AliasCSS syntax was used
202
+ !!extractProperty(pnv, cssPropsWithAlias); // or the property / alias is known
203
+ if (looksLikeAcss(className, pnv) || config.debug) {
204
+ console.warn(`AliasCSS: can't compile "${className}"`);
205
+ }
206
+ // console.log(`Unable to process ${className} [media:${mediaEX},pseudoSelector:${elementAndPseudo},imp:${important}]`)
207
+ }
208
+ },
209
+ makeNested(className, as, bool) {
210
+ var _a;
211
+ // --Group Statement
212
+ if (this.cssProps.hasOwnProperty(className)) {
213
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'statement')) {
214
+ return this.group(this.cssProps[className].statement, className);
215
+ }
216
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'raw')) {
217
+ return this.cssProps[className].statement;
218
+ }
219
+ }
220
+ // inline-group
221
+ if (/--as-[a-zA-Z0-9-_]+$/.test(className)) {
222
+ const asMatch = (_a = className.match(/--as-([a-zA-Z0-9-_]+)$/)) !== null && _a !== void 0 ? _a : [null, null];
223
+ if (asMatch[0] && asMatch[1]) {
224
+ return this.group(className.replace(asMatch[0], ''), asMatch[1]);
225
+ }
226
+ }
227
+ let unPrefixedClassName = className;
228
+ // check for [group-acss,]
229
+ const matchGroupCSS = className.match(/\[([^[]*)\]$/);
230
+ if (matchGroupCSS) {
231
+ const asString = splitByCommaOutsideParens(matchGroupCSS[1])
232
+ // .split(',')
233
+ .map(e => (className.replace(matchGroupCSS[0], '') + "-").replace(/--$/, '-') + e.replace(/^--/, '-'))
234
+ .join(' ');
235
+ return this.group(asString, as ? as : className);
236
+ }
237
+ //
238
+ let beforeClassNameSelector = '';
239
+ if (this.prefix && !className.match(new RegExp('^' + this.prefix + "[-]"))) {
240
+ return null;
241
+ }
242
+ else if (this.prefix) {
243
+ unPrefixedClassName = className.replace(new RegExp('^' + this.prefix + "[-]"), '');
244
+ }
245
+ if (!this.mediaTest)
246
+ this.mediaTest = createRegexForMedia(this.mediaSelector);
247
+ // 1. check and extract Media prefix and return className with prefix treatment,
248
+ let [extractedMedia, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
249
+ const mediaEX = extractedMedia;
250
+ // lint escape for const
251
+ extractedMedia = extractedMedia;
252
+ // 2. search for '&' which tells us to use selector before or after className
253
+ if (workingClassName.match(/[&]/)) {
254
+ const [before, after] = workingClassName.split('&');
255
+ beforeClassNameSelector = extractPrefix(before + "-display-none")[0] + " ";
256
+ if (!beforeClassNameSelector.trim()) {
257
+ console.error('Not a valid AliasCSS className:' + className, 'Make sure to provide valid css aliascss selector before "&" identifier');
258
+ return null;
259
+ }
260
+ else {
261
+ beforeClassNameSelector = beforeClassNameSelector.replace(/^([\s]?[+~>])(.*)/, "$2$1 ");
262
+ }
263
+ workingClassName = workingClassName.replace(before, '').replace('&', '');
264
+ }
265
+ let [elementAndPseudo, important] = ['', ''];
266
+ // workingClassName=workingClassName.replace(/[_][\.]([a-zA-Z])/g,(s,e)=>"_"+'ACSS').replace(/[.]/g,"d").replace(/[%]/g,'p')
267
+ // 3. Process --important flag
268
+ if (/(-i|--important)$/.test(className)) {
269
+ important = ' !important';
270
+ workingClassName = workingClassName.replace(/(-i|--important)$/, '');
271
+ }
272
+ // 4. process Pseudo State
273
+ const prefixPseudoElementAttribute = extractPrefix(workingClassName);
274
+ workingClassName = prefixPseudoElementAttribute[1];
275
+ elementAndPseudo = prefixPseudoElementAttribute[0];
276
+ // ---------------------------------------------------------------------
277
+ const pnv = workingClassName.replace(/^-([a-zA-Z])/, '$1');
278
+ let result = '';
279
+ // x-class
280
+ // if(/^(x-width|x-height)/.test(pnv)){
281
+ // const extract=getPropertyAndValue(pnv.replace('x-',''), this.cssProps, this.staticClassNames, this.custom,extractProperty);
282
+ // if(typeof extract === 'string'){
283
+ // const [p,v]=extract.split(':');
284
+ // if(p && v){
285
+ // result=`${p}:calc(${v} + var(--x-${p}-grow,0px) - var(--x-${p}-shrink,0px));`
286
+ // }
287
+ // }
288
+ // }else
289
+ if (this.cache.propertyAndValue.hasOwnProperty(pnv)) {
290
+ result = this.cache.propertyAndValue[pnv];
291
+ }
292
+ else {
293
+ try {
294
+ result = getPropertyAndValue(pnv, this.cssProps, this.staticClassNames, this.custom, extractProperty);
295
+ }
296
+ catch (error) {
297
+ console.log(error);
298
+ }
299
+ }
300
+ // if(result){
301
+ // className=className.replace(/([$.&%=\]\[@~:*#+\(\)\/^])/g,'\\$1');
302
+ // if(bool===true) return result;
303
+ // this.cache.propertyAndValue[pnv]=result;
304
+ // if(media){
305
+ // return `${media}{${
306
+ // beforeClassNameSelector+'.'+(as?as:className)+ elementAndPseudo
307
+ // }{${result}${important}}}`;
308
+ // }else{
309
+ // return `${beforeClassNameSelector}.${(as?as:className)}${elementAndPseudo}{${result}${important}}`;
310
+ // }
311
+ // }else{
312
+ // console.log(`Unable to process ${className} [media:${media},pseudoSelector:${elementAndPseudo},imp:${important}]`)
313
+ // }
314
+ // ------------PostCSSParse
315
+ if (result) {
316
+ let stm = '';
317
+ className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)\/^/</>\\])/g, '\\$1');
318
+ if (bool === true)
319
+ return result;
320
+ this.cache.propertyAndValue[pnv] = result;
321
+ if (mediaEX.length) {
322
+ let [bf, af] = ['', ''];
323
+ mediaEX.map((e) => {
324
+ const mediaQuery = e.split('::::')[0];
325
+ const mediaPrefix = e.split('::::')[1].replace(/^@/, '');
326
+ if (['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(mediaPrefix) !== -1) {
327
+ bf = bf + `@layer ${mediaPrefix}{ ${mediaQuery} {`;
328
+ af = af + "}}";
329
+ }
330
+ else {
331
+ bf = bf + mediaQuery + "{ ";
332
+ af = af + "}";
333
+ }
334
+ });
335
+ stm = `${bf}${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}${af}`;
336
+ }
337
+ else {
338
+ stm = `${beforeClassNameSelector}.${className}${elementAndPseudo}{${result}${important}}`;
339
+ }
340
+ try {
341
+ postcss.parse(stm);
342
+ return stm;
343
+ }
344
+ catch (error) {
345
+ console.log('Not a Valid CSS Statement, PostCSS Parse:', stm);
346
+ }
347
+ }
348
+ else {
349
+ console.log(`Unable to process ${className} [media:${mediaEX},pseudoSelector:${elementAndPseudo},imp:${important}]`);
350
+ }
351
+ },
352
+ // groupSingle(str:string, as:string){
353
+ // let pnv='';
354
+ // },
355
+ group(str, as) {
356
+ let statement = '';
357
+ [...str.trim().split(/\s+/)].forEach((e) => {
358
+ const getEachClassNameCompiled = this.make(e, as);
359
+ if (getEachClassNameCompiled)
360
+ statement += getEachClassNameCompiled + ' \n';
361
+ });
362
+ return statement;
363
+ },
364
+ groupMulti(str, as) {
365
+ let statement = '.' + as + '{\n';
366
+ [...str.trim().split(/\s+/)].forEach((e) => {
367
+ const getEachClassNameCompiled = this.make(e, as, true);
368
+ if (getEachClassNameCompiled)
369
+ statement += getEachClassNameCompiled + '; \n';
370
+ });
371
+ return statement + '}';
372
+ },
373
+ prebuild(a, b) {
374
+ if (typeof a === 'object') {
375
+ for (const key in a) {
376
+ if (a.hasOwnProperty(key))
377
+ this.cache.propertyAndValue[key] = a[key];
378
+ }
379
+ }
380
+ else {
381
+ if (a && b) {
382
+ this.cache.propertyAndValue[a] = b;
383
+ }
384
+ }
385
+ },
386
+ groupForJs(str, bool) {
387
+ if (!str.trim())
388
+ return '';
389
+ const jsStyle = {};
390
+ const list = str.trim().split(/\s+/);
391
+ list.forEach((e) => {
392
+ let pNv = '';
393
+ if (this.cache.propertyAndValue.hasOwnProperty(e)) {
394
+ pNv = this.cache.propertyAndValue[e];
395
+ }
396
+ else {
397
+ pNv = getPropertyAndValue(e, this.cssProps, this.staticClassNames, this.custom, extractProperty);
398
+ if (pNv)
399
+ this.cache.propertyAndValue[e] = pNv;
400
+ }
401
+ if (!pNv)
402
+ return '';
403
+ const result = pNv.split(':');
404
+ if (result.length === 2) {
405
+ const key = result[0].replace(/-([a-z])/g, (e, a) => {
406
+ return a.toUpperCase();
407
+ });
408
+ let value = bool === true ? result[1].replace(/px$/g, '') : result[1];
409
+ if (typeof value === 'string' && value.trim().match(/^[\d\.]+$/)) {
410
+ value = parseFloat(value.toString());
411
+ }
412
+ jsStyle[key] = value;
413
+ }
414
+ });
415
+ return jsStyle;
416
+ },
417
+ // obj:{'container':'p20px m-12pxx, 'section':'mt16px'}
418
+ groupObj(obj) {
419
+ if (typeof obj !== 'object')
420
+ return false;
421
+ let statement = '';
422
+ for (const key in obj) {
423
+ if (obj.hasOwnProperty(key)) {
424
+ const result = this.group(obj[key], key);
425
+ if (result) {
426
+ statement += result + '\n';
427
+ }
428
+ }
429
+ }
430
+ return statement;
431
+ },
432
+ addCustom(name, obj) {
433
+ name = (name === 'color' ? 'colors' : name);
434
+ if (typeof obj === 'object') {
435
+ if (!this.custom[name])
436
+ this.custom[name] = {};
437
+ for (const key in obj) {
438
+ if (obj.hasOwnProperty(key))
439
+ this.custom[name][key] = obj[key];
440
+ }
441
+ }
442
+ },
443
+ addMedia(obj) {
444
+ this.mediaSelector = Object.assign(Object.assign({}, this.mediaSelector), obj);
445
+ },
446
+ addPseudo(obj) {
447
+ // this.mediaSelector={...this.mediaSelector,...obj}
448
+ },
449
+ // styleToAliascss(value:string,bool:boolean){
450
+ // let classValue='';
451
+ // let styleValue='';
452
+ // value.split(/\s*;\s*/).forEach((each)=>{
453
+ // const [property,value]=each.match(/:/)?each.split(':'):['',''];
454
+ // if(property && value){
455
+ // if(cssProps.hasOwnProperty(property.trim())){
456
+ // classValue+=`${(bool===true && cssProps[property.trim()].alias)?cssProps[property.trim()].alias:property}-${
457
+ // value.trim().replace(/['"]/g, '').replace(/#/g, '').replace(/\((^\()\)/g, (m,s)=>'-'+s.replace(/[\s]*,[\s]*/g,'-'))
458
+ // .replace(/\s/g, '-').replace(/^var---/g,'-').replace(/-var-/g,'')
459
+ // }`
460
+ // }else{
461
+ // styleValue+=each+'; ';
462
+ // }
463
+ // }else {
464
+ // styleValue+=each+'; ';
465
+ // }
466
+ // })
467
+ // }
468
+ };
469
+ // compiler.staticClassNames={...helper().generateStaticClassNames(compiler.cssProps,config['css-global-values'])};
470
+ // compiler.addCustom('color',customColors)
@@ -1,3 +1,4 @@
1
+ export declare function isSafeCss(css: string): boolean;
1
2
  export declare const compiler: {
2
3
  make: (a: string, b?: string, c?: boolean) => string;
3
4
  group: (a: string, b: string) => string;