aliascss 1.4.7 → 1.5.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.
@@ -4,8 +4,11 @@ import { splitByCommaOutsideParens } from './utils/helper.js';
4
4
  // import mapRawAttributeNames from './utils/browser-helper.js';
5
5
  export default statementMaker;
6
6
  export let classPrinter = {
7
- invalidLists: [],
8
- classLists: [],
7
+ invalidLists: new Set(), // was arrays + indexOf: O(n) per lookup
8
+ classLists: new Set(),
9
+ doneGroups: new Set(), // class:name="…" groups already emitted
10
+ buffer: [], // CSS waiting to be written
11
+ flushQueued: false,
9
12
  styleTagExists: false,
10
13
  customCheck: false,
11
14
  useColon: true,
@@ -28,9 +31,25 @@ export let classPrinter = {
28
31
  return styleTag;
29
32
  },
30
33
  // you can always append a class if you like modify the look here if you want
34
+ // Buffered: every append used to add a text node, and each one makes the browser
35
+ // re-parse the whole <style> (slow on big pages). Now statements are collected and
36
+ // written in one text node per microtask: still before the next paint, so no flash.
31
37
  appendToStyleTag(classStatement) {
32
- const createNewClass = document.createTextNode(classStatement);
33
- this.createStyleTag().appendChild(createNewClass);
38
+ if (!classStatement)
39
+ return;
40
+ this.buffer.push(classStatement);
41
+ if (!this.flushQueued) {
42
+ this.flushQueued = true;
43
+ queueMicrotask(() => this.flush());
44
+ }
45
+ },
46
+ flush() {
47
+ this.flushQueued = false;
48
+ if (!this.buffer.length)
49
+ return;
50
+ const css = this.buffer.join('\n');
51
+ this.buffer = [];
52
+ this.createStyleTag().appendChild(document.createTextNode(css));
34
53
  },
35
54
  // compile dom stylesheet
36
55
  // show current style statement
@@ -51,8 +70,8 @@ export let classPrinter = {
51
70
  print(el) {
52
71
  // initialize class or acss-class value container
53
72
  let attrValue = '';
54
- const testRegExp = this.useColon ? /class[-_:]/ : /class[-_]/;
55
- const testRegExpKF = this.useColon ? /keyframes[-_:]/ : /keyframes[-_]/;
73
+ const testRegExp = this.useColon ? /^class[-_:]/ : /^class[-_]/;
74
+ const testRegExpKF = this.useColon ? /^keyframes[-_:]/ : /^keyframes[-_]/;
56
75
  // const rawCSS=/data-raw-css/;
57
76
  // if class
58
77
  if (el.getAttribute('class'))
@@ -72,10 +91,12 @@ export let classPrinter = {
72
91
  group = group.replace(match[0], '');
73
92
  value = value.trim().split(/\s+/).map(e => match[0].replace(/^\[/, '').replace(/\]$/, '') + (/^[_-]/.test(e) ? '' : '-') + e).join(" ");
74
93
  }
75
- const result = statementMaker.group(value, group);
76
- if (result) {
77
- this.appendToStyleTag(result);
78
- // return true;
94
+ const key = group + '\u0000' + value;
95
+ if (!this.doneGroups.has(key)) {
96
+ this.doneGroups.add(key);
97
+ const result = statementMaker.group(value, group);
98
+ if (result)
99
+ this.appendToStyleTag(result);
79
100
  }
80
101
  }
81
102
  // -------
@@ -133,9 +154,9 @@ export let classPrinter = {
133
154
  // looping class
134
155
  tmpClassList.forEach((eachClass) => {
135
156
  // escape repeated class name
136
- if (this.classLists.indexOf(eachClass) === -1 && this.invalidLists.indexOf(eachClass) === -1) {
157
+ if (!this.classLists.has(eachClass) && !this.invalidLists.has(eachClass)) {
137
158
  // add to classlist for reference
138
- this.classLists.push(eachClass);
159
+ this.classLists.add(eachClass);
139
160
  // var result=compiler.main(eachClass);
140
161
  const result = statementMaker.make(eachClass);
141
162
  // console.log(result);
@@ -144,7 +165,7 @@ export let classPrinter = {
144
165
  }
145
166
  else {
146
167
  // not a valid ACSS classNames
147
- this.invalidLists.push(eachClass);
168
+ this.invalidLists.add(eachClass);
148
169
  }
149
170
  }
150
171
  });
@@ -155,7 +176,7 @@ export let classPrinter = {
155
176
  let statement = ' ';
156
177
  // initialize class or acss-class value container
157
178
  let attrValue = '';
158
- const testRegExp = this.useColon ? /class[-_:]/ : /class[-_]/;
179
+ const testRegExp = this.useColon ? /^class[-_:]/ : /^class[-_]/;
159
180
  // matchRegExp:/(?:(class|className|class[-_][\w-\[\]=_]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
160
181
  // matchRegExpWithColon:/(?:(class|className|class[-_:][\w-\[\]=_]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
161
182
  // if class
@@ -197,10 +218,6 @@ export let classPrinter = {
197
218
  statement += result + ' ';
198
219
  // this.appendToStyleTag(result);
199
220
  }
200
- else {
201
- // not a valid ACSS classNames
202
- console.log('Not a valid Aliascss class name:' + eachClass);
203
- }
204
221
  }
205
222
  });
206
223
  return statement;
@@ -228,7 +245,6 @@ export let classPrinter = {
228
245
  return statement;
229
246
  },
230
247
  run(el) {
231
- var _a;
232
248
  const $root = el || document;
233
249
  // $root.dispatchEvent(event);
234
250
  $root.dispatchEvent(new CustomEvent('acss:init', { bubbles: true, detail: { aliascss: this } }));
@@ -241,8 +257,16 @@ export let classPrinter = {
241
257
  // });
242
258
  // const event = new Event('acss:init');
243
259
  // create a keyframes object to fix case-sensitive issue
244
- (_a = (el || document.body).outerHTML.match(/keyframes-[a-z0-9_-]+(?==)/gi)) === null || _a === void 0 ? void 0 : _a.forEach((each) => {
245
- this.kfNames[each.replace('keyframes-', '').toLowerCase()] = each.replace('keyframes-', '');
260
+ // (was: outerHTML of the whole page + regex, which serialises the entire document)
261
+ const kfRoot = (el || document.body);
262
+ const kfNodes = [kfRoot, ...kfRoot.querySelectorAll('*')];
263
+ kfRoot.querySelectorAll('template').forEach((t) => kfNodes.push(...t.content.querySelectorAll('*')));
264
+ kfNodes.forEach((node) => {
265
+ for (const attr of node.attributes) {
266
+ const m = attr.name.match(/^keyframes[-_:](.+)$/i);
267
+ if (m)
268
+ this.kfNames[m[1].toLowerCase()] = m[1];
269
+ }
246
270
  });
247
271
  // <template> element
248
272
  Array.prototype.forEach.call($root.querySelectorAll('template'), (template) => {
@@ -262,5 +286,307 @@ export let classPrinter = {
262
286
  Array.prototype.forEach.call($root.querySelectorAll('[data-raw-css]'), (e) => {
263
287
  this.appendToStyleTag(e.getAttribute('data-raw-css'));
264
288
  });
289
+ this.flush(); // write the whole first pass in one go
265
290
  },
266
291
  };
292
+ /*
293
+ import { compiler as statementMaker} from './returnStatement.js';
294
+ import config from './config.js';
295
+ import { splitByCommaOutsideParens} from './utils/helper.js';
296
+ // import mapRawAttributeNames from './utils/browser-helper.js';
297
+ export default statementMaker;
298
+ type ClassPrinter = { [key: string]: any };
299
+ export let classPrinter: ClassPrinter = {
300
+ invalidLists: [],
301
+ classLists: [],
302
+ styleTagExists: false,
303
+ customCheck: false,
304
+ useColon:true,
305
+ cls: {},
306
+ kfs: {},
307
+ kfNames:{},
308
+
309
+ styleTag: null,
310
+ createStyleTag() {
311
+ if (this.styleTagExists === true) {
312
+ return this.styleTag;
313
+ }
314
+ const styleTag = document.createElement('style');
315
+ styleTag.id = 'styleAlias';
316
+ document.getElementsByTagName('head')[0].appendChild(styleTag);
317
+ // initialize @layer for reset, base, theme, components and utilities
318
+ const initLayer = document.createTextNode(
319
+ `@layer ${config.layers.join(', ')};`
320
+ );
321
+ styleTag.appendChild(initLayer);
322
+ this.styleTag = styleTag;
323
+ this.styleTagExists = true;
324
+ return styleTag;
325
+ },
326
+ // you can always append a class if you like modify the look here if you want
327
+ appendToStyleTag(classStatement: string) {
328
+ const createNewClass = document.createTextNode(classStatement);
329
+ this.createStyleTag().appendChild(createNewClass);
330
+ },
331
+ // compile dom stylesheet
332
+ // show current style statement
333
+ compile() {
334
+ const classes = document.getElementById('styleAlias');
335
+ if (classes) {
336
+ const prettyPrint = classes.innerHTML
337
+ .replace(/\}/g, '</br>}</br>')
338
+ .replace(/\{/g, '{</br>&nbsp;&nbsp;&nbsp;&nbsp;');
339
+ document.write(prettyPrint);
340
+ } else {
341
+ console.warn('There is not ACSS used in this document!!');
342
+ alert('Could not found acss statements in this Document!');
343
+ }
344
+ },
345
+
346
+ // print className of el to style tag; gets statement from statementMaker.make(eachClass);
347
+ print(el: HTMLElement) {
348
+
349
+ // initialize class or acss-class value container
350
+ let attrValue = '';
351
+ const testRegExp=this.useColon? /class[-_:]/: /class[-_]/;
352
+ const testRegExpKF=this.useColon? /keyframes[-_:]/: /keyframes[-_]/;
353
+ // const rawCSS=/data-raw-css/;
354
+
355
+ // if class
356
+ if (el.getAttribute('class')) attrValue += ' ' + el.getAttribute('class');
357
+
358
+ // if acss-class
359
+ // if (el.getAttribute('acss-class')) attrValue += ' ' + el.getAttribute('acss-class');
360
+ // new Update
361
+ [...el.attributes].map((each)=>{
362
+ // ------------
363
+ // Raw-CSS Statement
364
+
365
+ // class-group
366
+ if( testRegExp.test(each.name)){
367
+ let value=each.value;
368
+ let group=each.name.replace(testRegExp,'');
369
+ const match=group.match(/\[(.)+\]/);
370
+ if(match){
371
+ group=group.replace(match[0],'');
372
+ value=value.trim().split(/\s+/).map(e=>match[0].replace(/^\[/,'').replace(/\]$/,'')+(/^[_-]/.test(e)?'':'-')+e).join(" ");
373
+ }
374
+ const result = statementMaker.group(value, group);
375
+ if (result) {
376
+ this.appendToStyleTag(result);
377
+ // return true;
378
+ }
379
+ }
380
+ // -------
381
+ // if( testRegExp.test(each.name)){
382
+ // const result = statementMaker.group(each.value, each.name.replace(testRegExp,''));
383
+ // if (result) {
384
+ // this.appendToStyleTag(result);
385
+ // // return true;
386
+ // }
387
+ // }
388
+ if( testRegExpKF.test(each.name)){
389
+ const key=each.name.replace(testRegExpKF,'');
390
+ let kfStatement='@keyframes '+ this.kfNames[key] +"{\n";
391
+ const returnPnV=(e:string[])=>e.map((i)=>statementMaker.make(i,undefined,true)).join(";");
392
+ const split=each.value.trim().split(/\s+/);
393
+ split.forEach((each:string) => {
394
+ try {
395
+ const[at,pNv]=each.replace(/\]\[/,']-[').replace("-","=").split("=");
396
+ // const result=returnPnV(pNv.replace(/^\[|\]$/g,'').split(','));
397
+ const result=returnPnV(splitByCommaOutsideParens(pNv.replace(/^\[|\]$/g,'')));
398
+ kfStatement+=` ${at.replace('@','').replace(/:/g,',').replace(/,/g,"%,").replace(/[\[|\]]/g,'')}% {${result?result:''}}`
399
+ } catch (error) {
400
+ console.log('invalid Entry for AliasCSS keyframes processor : '+each,error);
401
+ }
402
+
403
+ });
404
+ this.appendToStyleTag(kfStatement+ "\n}");
405
+ }
406
+
407
+ })
408
+
409
+ // if has value to process
410
+ if (!attrValue.trim()) return;
411
+
412
+ // has-test-group(for live update only)
413
+ /* if (el.getAttribute('acss-group-test')) {
414
+ const result = statementMaker.group(attrValue, el.getAttribute('acss-group-test')||'');
415
+ const styleTag = document.querySelector('style#' + el.getAttribute('acss-group-test'));
416
+ if (result) {
417
+ if (styleTag) {
418
+ styleTag.innerHTML = '';
419
+ const createNewGroup = document.createTextNode(result);
420
+ styleTag.appendChild(createNewGroup);
421
+ // return true;
422
+ } else {
423
+ const styleTag: any = document.createElement('style');
424
+ styleTag.id = el.getAttribute('acss-group-test');
425
+ document.getElementsByTagName('head')[0].appendChild(styleTag);
426
+ const createNewGroup = document.createTextNode(result);
427
+ styleTag.appendChild(createNewGroup);
428
+ }
429
+ }
430
+ } */
431
+ // -----------------------end of for live update
432
+ /*
433
+ // get class and trim out white spaces
434
+ const tmpClassList = attrValue.trim().split(/\s+/);
435
+
436
+ // looping class
437
+ tmpClassList.forEach((eachClass: string) => {
438
+ // escape repeated class name
439
+
440
+ if (this.classLists.indexOf(eachClass) === -1 && this.invalidLists.indexOf(eachClass) === -1) {
441
+ // add to classlist for reference
442
+ this.classLists.push(eachClass);
443
+
444
+ // var result=compiler.main(eachClass);
445
+ const result = statementMaker.make(eachClass);
446
+ // console.log(result);
447
+
448
+ if (result) {
449
+ this.appendToStyleTag(result);
450
+ } else {
451
+ // not a valid ACSS classNames
452
+ this.invalidLists.push(eachClass);
453
+ }
454
+ }
455
+ });
456
+ }, // end-of-main
457
+ // returns css statement from current element
458
+ compileElement(el: HTMLElement, list: [] = []) {
459
+ const classList: string[] = list;
460
+ let statement = ' ';
461
+ // initialize class or acss-class value container
462
+ let attrValue = '';
463
+ const testRegExp=this.useColon? /class[-_:]/: /class[-_]/;
464
+ // matchRegExp:/(?:(class|className|class[-_][\w-\[\]=_]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
465
+ // matchRegExpWithColon:/(?:(class|className|class[-_:][\w-\[\]=_]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
466
+
467
+ // if class
468
+ if (el.getAttribute('class')) attrValue += ' ' + el.getAttribute('class');
469
+ // New update 2023-aug-03
470
+
471
+ [...el.attributes].map((each)=>{
472
+
473
+ if( testRegExp.test(each.name)){
474
+ let value=each.value;
475
+ let group=each.name.replace(testRegExp,'');
476
+ const match=group.match(/\[(.)+\]/);
477
+ if(match){
478
+ group=group.replace(match[0],'');
479
+ value=value.trim().split(/\s+/).map(e=>match[0].replace(/^\[/,'').replace(/\]$/,'')+(/^[_-]/.test(e)?'':'-')+e).join(" ");
480
+ }
481
+ const result = statementMaker.group(value, group);
482
+ if (result) {
483
+ this.appendToStyleTag(result);
484
+ // return true;
485
+ }
486
+ }
487
+
488
+ })
489
+ // if acss-class
490
+ // if (el.getAttribute('acss-class')) attrValue += ' ' + el.getAttribute('acss-class');
491
+
492
+ // if has value to process
493
+ if (!attrValue.trim()) return;
494
+
495
+ // get class and trim out whitespace
496
+ const tmpClassList = attrValue.trim().split(/\s+/);
497
+
498
+ // looping class
499
+ tmpClassList.forEach((eachClass) => {
500
+ // escape repeated className
501
+ if (classList.indexOf(eachClass) === -1) {
502
+ classList.push(eachClass);
503
+ // var result=compiler.main(eachClass);
504
+ const result = statementMaker.make(eachClass);
505
+ // console.log(result);
506
+
507
+ if (result) {
508
+ statement += result + ' ';
509
+ // this.appendToStyleTag(result);
510
+ } else {
511
+ // not a valid ACSS classNames
512
+ console.log('Not a valid Aliascss class name:' + eachClass);
513
+ }
514
+ }
515
+ });
516
+
517
+ return statement;
518
+ },
519
+ // returns css statement from given element and child
520
+ returnStatement($el: HTMLElement) {
521
+ let statement = '';
522
+ const classList: [] = [];
523
+ const processOuterHtml= this.compileElement($el, classList);
524
+ statement+=processOuterHtml ? processOuterHtml : '';
525
+
526
+ // <template> element
527
+ Array.prototype.forEach.call($el.querySelectorAll('template'), (template) => {
528
+ // Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
529
+ Array.prototype.forEach.call(template.content.querySelectorAll('[class]'), (e) => {
530
+ const result = this.compileElement(e, classList);
531
+ statement += result ? result : '';
532
+ });
533
+ });
534
+
535
+ // <html>
536
+
537
+ // Array.prototype.forEach.call($el.querySelectorAll('[class],[acss-class]'), (e) => {
538
+ Array.prototype.forEach.call($el.querySelectorAll('[class]'), (e) => {
539
+ const result = this.compileElement(e, classList);
540
+ statement += result ? result : '';
541
+ });
542
+
543
+ return statement;
544
+ },
545
+ run(el: HTMLElement) {
546
+ const $root = el || document;
547
+
548
+ // $root.dispatchEvent(event);
549
+ $root.dispatchEvent(new CustomEvent('acss:init', { bubbles: true , detail:{aliascss:this}}));
550
+ // mapRawAttributeNames().then(({ kfs, cls }) => {
551
+ // // Use the variables inside this block
552
+ // this.cls = cls;
553
+ // this.kfs = kfs;
554
+ // }).catch(error => {
555
+ // console.error("cannot initialize keyframes and class-grouping for case free names:", error);
556
+ // });
557
+
558
+ // const event = new Event('acss:init');
559
+
560
+
561
+
562
+ // create a keyframes object to fix case-sensitive issue
563
+ (el||document.body).outerHTML.match(/keyframes-[a-z0-9_-]+(?==)/gi)?.forEach((each)=>{
564
+ this.kfNames[each.replace('keyframes-','').toLowerCase()]=each.replace('keyframes-','');
565
+
566
+ })
567
+
568
+
569
+
570
+ // <template> element
571
+ Array.prototype.forEach.call($root.querySelectorAll('template'), (template) => {
572
+ // Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
573
+ Array.prototype.forEach.call(template.content.querySelectorAll('[class]'), (e) => {
574
+ this.print(e);
575
+ });
576
+ Array.prototype.forEach.call(template.content.querySelectorAll('[data-raw-css]'), (e) => {
577
+ this.appendToStyleTag(e.getAttribute('data-raw-css'));
578
+ });
579
+ });
580
+
581
+ // <html>
582
+
583
+ // Array.prototype.forEach.call($root.querySelectorAll('[class],[acss-class]'), (e) => {
584
+ Array.prototype.forEach.call($root.querySelectorAll('[class]'), (e) => {
585
+ this.print(e);
586
+ });
587
+ Array.prototype.forEach.call($root.querySelectorAll('[data-raw-css]'), (e) => {
588
+ this.appendToStyleTag(e.getAttribute('data-raw-css'));
589
+ });
590
+ },
591
+
592
+ };*/
package/lib/config.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  declare const config: {
2
2
  prefix: string | null;
3
+ debug: boolean;
3
4
  matchExtractorFunction: RegExp | null;
4
5
  matchRegExp: RegExp;
5
6
  asRegExpMatcher: RegExp;
package/lib/config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const config = {
2
2
  prefix: null,
3
3
  useColon: false,
4
+ debug: true,
4
5
  ignore: [],
5
6
  layers: ['reset', 'base', 'theme', 'components', 'utilities', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
6
7
  useExtractorFunction: false, // (?<=x(`|\(['"]))([\s\w-\(\)]+)[^`"']
@@ -2,38 +2,7 @@ import prebuild from "./prebuild.js";
2
2
  import { cssVarWithDefault } from "./utils/helper.js";
3
3
  import color from './compilers/color.js';
4
4
  import length from './compilers/length.js';
5
- const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
6
- // 'Button':{
7
- // type:'group',
8
- // compiler:(value,custom)=>{
9
- // let stm='';
10
- // const order=['color','background-color','border-color'];
11
- // const values=value.replace(/^\(|\)$/g,'').split(',');
12
- // values.forEach((e,i)=>{
13
- // if(i<order.length){
14
- // stm+=`${order[i]}:${color(e,custom)};`
15
- // }
16
- // });
17
- // return stm;
18
- // }
19
- // options:{
20
- // 'solid':'background-color:var(--main-color),color:var(--main-text-color,#fff)',
21
- // 'outline':'--background-color:var(--outline-bg-color,transparent),--button-color:var(--main-color)',
22
- // 'link':'background-color:var(--outline-bg-color,transparent),color:var(--main-color),border:none',
23
- // 'ghost':'background:transparent',
24
- // 'primary':'--button-main-color:var(--primary-color,),',
25
- // 'success':'',
26
- // 'error':'',
27
- // 'warning':'',
28
- // 'info':'',
29
- // 'xs':'border-radius: 4px;padding: 0px 8px;font-size: 12px;height: 24px;line-height: 16px;gap: 4px;',
30
- // 'sm':'border-radius: 4px;padding: 0px 12px;font-size: 14px;height: 32px;line-height: 20px;gap: 8px;',
31
- // 'md':'border-radius: 4px;padding: 0px 15px;font-size: 15px;font-weight: 500;height: 35px;line-height: 1;',
32
- // 'lg':'border-radius: 6px;padding: 0px 16px;font-size: 16px;height: 40px;line-height: 24px;gap: 12px;',
33
- // 'lg':'border-radius: 6px; padding: 0px 24px;font-size: 18px;height: 48px;line-height: 26px;gap: 14px;',
34
- // },
35
- // },
36
- 'InsetRA': {
5
+ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), { 'InsetRA': {
37
6
  type: 'group',
38
7
  compiler: (value, custom) => {
39
8
  // const val=value.replace(/^\(/,'').replace(/\)$/,'').trim();
@@ -752,42 +721,6 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
752
721
  },
753
722
  },
754
723
  // ---------------------x-custom-compiler
755
- 'x-row': {
756
- type: 'group',
757
- compiler: (value) => {
758
- return `--x-row-gap:${value.trim() ? value.replace(/^-(\d)/, '$1') : '16px'};display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * -0.5);margin-right:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * -0.5);`;
759
- },
760
- groups: {
761
- 'xs': `--x-row-gap:4px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,4px) * -0.5);margin-right:calc(var(--x-row-gap,4px) * -0.5);`,
762
- 'sm': `--x-row-gap:8px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,8px) * -0.5);margin-right:calc(var(--x-row-gap,8px) * -0.5);`,
763
- 'md': `--x-row-gap:16px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,16px) * -0.5);margin-right:calc(var(--x-row-gap,16px) * -0.5);`,
764
- 'lg': `--x-row-gap:24px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,24px) * -0.5);margin-right:calc(var(--x-row-gap,24px) * -0.5);`,
765
- 'xl': `--x-row-gap:32px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,32px) * -0.5);margin-right:calc(var(--x-row-gap,32px) * -0.5);`,
766
- },
767
- }, 'x-col': {
768
- type: 'group',
769
- compiler: (value) => {
770
- return `--x-col-width:${value.replace(/^-(\d)/, '$1')};padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5);box-sizing:border-box;flex:0 0 var(--x-col-width,${value.replace(/^-(\d)/, '$1')});max-width:var(--x-col-width,${value.replace(/^-(\d)/, '$1')});`;
771
- },
772
- groups: {
773
- '1': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 8.333%;max-width:8.333%;`,
774
- '2': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 16.6667%;max-width:16.6667%;`,
775
- '3': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 25%;max-width:25%;`,
776
- '4': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 33.3333%;max-width:33.3333%;`,
777
- '5': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 41.6667%;max-width:41.6667%;`,
778
- '6': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 50%;max-width:50%;`,
779
- '7': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 58.3333%;max-width:58.3333%;`,
780
- '8': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 66.6667%;max-width:66.6667%;`,
781
- '9': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 75%;max-width:75%;`,
782
- '10': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 83.3333%;max-width:83.3333%;`,
783
- '11': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 91.6667%;max-width:91.6667%;`,
784
- '12': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 100%;max-width:100%;`,
785
- },
786
- },
787
- // 'x-col-responsive':{
788
- // type:'statement',
789
- // statement:`[]`,
790
- // },
791
724
  'x-square': {
792
725
  type: 'group',
793
726
  compiler: (value) => {
@@ -0,0 +1,27 @@
1
+ export default function main(config: {
2
+ [key: string]: any;
3
+ input: string | string[];
4
+ }): Promise<void>;
5
+ export declare function globalCSSCompiler(): Promise<void>;
6
+ export declare function compileFile(file: string, config: any, statementMaker: {
7
+ make: (a: string, b?: any, c?: any) => string;
8
+ group: (a: string, b: string) => string;
9
+ rawCSS?: string;
10
+ customGroupStatement?: string;
11
+ }, globalClassList: string[]): string[];
12
+ export declare function groupStatement(name: string, classNames: string, statementMaker: {
13
+ group: (a: string, b: string) => string;
14
+ }): string;
15
+ export declare function keyframesStatement(name: string, timeLine: string, statementMaker: {
16
+ make: (a: string, b?: string | null, c?: boolean) => string;
17
+ }): string;
18
+ export declare function createCSSFileByFile(file: string, bool?: boolean): Promise<void>;
19
+ export declare function postify(file: string, plugin: any[], minify?: boolean, sort?: "mobile-first" | "desktop-first"): Promise<void>;
20
+ export declare function writeStatementToFile(file: string, content: string, from?: string): void;
21
+ export declare function initialize(configFile: {
22
+ [key: string]: any;
23
+ }): void;
24
+ export declare function watch(config: {
25
+ [key: string]: any;
26
+ input: string | string[];
27
+ }): void;